Class: Cc::Api::Util::KeyChainsGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/api/util/key_chains_getter.rb

Constant Summary collapse

@@key_chains =
[]

Class Method Summary collapse

Class Method Details

.get_key_chains(elements, string, ignores = nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/cc/api/util/key_chains_getter.rb', line 7

def self.get_key_chains elements, string, ignores=nil
  puts "\navailable columns\n===================="
  self.key_chains elements, string, ignores
  puts "\nUSAGE:"
  puts "--cols #{[@@key_chains.sample, @@key_chains.sample, @@key_chains.sample].join(',')}"
end

.get_target_array(hash, target, id = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cc/api/util/key_chains_getter.rb', line 14

def self.get_target_array hash, target, id=nil
  begin
    a = hash
    target.split('.').each do |key|
      if key == 'FIRST'
        a = a[0]
      elsif key == 'PRODUCT_ID'
        a = a[id]
      else
        a = a[key]
      end
    end
    a
  rescue
    puts "Target not found."
  end
end