Class: Dropmire::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/dropmire/identity.rb

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Identity

Returns a new instance of Identity.



5
6
7
8
9
10
# File 'lib/dropmire/identity.rb', line 5

def initialize(text)
  p = Parser.new(text)
  p.parse

  @attrs = p.attrs
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/dropmire/identity.rb', line 12

def method_missing(method, *args, &block)
  is_attr = attrs.fetch(method, nil)
  if is_attr.nil? && !(dl_id_values.include?(method))
    super
  else
    key = find_key_from_method(method)
    attrs[key]
  end
end