Module: ArrayHash

Defined in:
lib/bucket_client/digital_ocean/digital_ocean_client.rb

Instance Method Summary collapse

Instance Method Details

#access(symbol) ⇒ Object



13
14
15
16
17
18
# File 'lib/bucket_client/digital_ocean/digital_ocean_client.rb', line 13

def access(symbol)
  raise ArgumentError "Cannot find symbol #{symbol.to_s}" unless has_key symbol
  r = find {|x| !x[symbol].nil?}[symbol]
  r.extend(ArrayHash)
  r
end

#get(symbol) ⇒ Object



20
21
22
23
24
25
# File 'lib/bucket_client/digital_ocean/digital_ocean_client.rb', line 20

def get(symbol)
  raise ArgumentError "Cannot find symbol #{symbol.to_s}" if self[symbol].nil?
  r = self[symbol]
  r.extend(ArrayHash)
  r
end

#has_key(symbol) ⇒ Object



27
28
29
# File 'lib/bucket_client/digital_ocean/digital_ocean_client.rb', line 27

def has_key(symbol)
  self.any? {|x| !x[symbol].nil?}
end