support/ruby/collins-shell/lib/collins_shell/console/command_helpers.rb
def find_assets tags_values, details
    q = tags_values.each_slice(2).inject({}) {|h,o| h.update(o[0].to_s.to_sym => o[1])}
    q.update(:details => details)
    selector = shell_handle.get_selector(q, nil, 5000)
    call_collins("find(#{selector})") do |c|
      if details then
        c.find(selector)
      else
        c.find(selector).map{|a| a.tag}.sort
      end
    end
  end
# Given an array of keys and values, return matching assets
# @param [Array<String>] tags_values an array where even elements are keys for a search and odd elements are values
# @param [Boolean] details If true, return full assets, otherwise return a sorted array of tags
# @return [Array<Collins::Asset>,Array<String>]
Given an array of keys and values, return matching assets
Given an array of keys and values return matching assets
def find_assets tags_values, details
    q = tags_values.each_slice(2).inject({}) {|h,o| h.update(o[0].to_s.to_sym => o[1])}
    q.update(:details => details)
    selector = shell_handle.get_selector(q, nil, 5000)
    call_collins("find(#{selector})") do |c|
      if details then
        c.find(selector)
      else
        c.find(selector).map{|a| a.tag}.sort
      end
    end
  end
def find_assets tags_values , details q = tags_values . each_slice ( 2 ) . inject ( { } ) { | h , o | h . update ( o [ 0 ] . to_s . to_sym => o [ 1 ] ) } q . update ( :details => details ) selector = shell_handle . get_selector ( q , nil , 5000 ) call_collins ( "find(#{selector})" ) do | c | if details then c . find ( selector ) else c . find ( selector ) . map { | a | a . tag } . sort end end end
Given an array of keys and values, return matching assets
Given an array of keys and values return matching assets
None
Array<Collins::Asset>,Array<String>
tags_values
details
details If true, return full assets, otherwise return a sorted array of tags
details If true return full assets otherwise return a sorted array of tags