Class: YAML::Object

Inherits:
BasicObject
Defined in:
lib/ig3client/yaml_client.rb

Overview

Capture serialised YAML Object

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



24
25
26
# File 'lib/ig3client/yaml_client.rb', line 24

def method_missing(sym,*args)
  self[sym]
end

Instance Method Details

#[](k) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ig3client/yaml_client.rb', line 11

def [](k)
  k = k.to_s
  if ivars["attributes"].include? k
    return ivars["attributes"][k]
  elsif ivars.include? k
    return ivars[k]
  else
    keys = ivars['attributes'].keys.join(', ')
    warn "No such attribute: #{k.to_s} (#{keys})"
    return nil
  end
end

#real_idObject



7
8
9
# File 'lib/ig3client/yaml_client.rb', line 7

def real_id
  ivars["attributes"]["id"]
end