Class: Sistrix::Domain::Overview::Record

Inherits:
Object
  • Object
show all
Includes:
Record
Defined in:
lib/sistrix/domain/overview.rb

Instance Method Summary collapse

Methods included from Record

#keys, #method_missing

Constructor Details

#initialize(xml_node) ⇒ Record

Returns a new instance of Record.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/sistrix/domain/overview.rb', line 42

def initialize(xml_node)
  @data = {}

  @data[:domain] = xml_node['domain'].strip

  begin
    @data[:date] = Time.parse(xml_node['date'].strip)
  rescue NoMethodError
    @data[:date] = nil
  end

  if xml_node.name == 'age'
    @data[:value] = Time.parse(xml_node['value'].strip)
  else
    if xml_node['value'] =~ /\./
      @data[:value] = xml_node['value'].strip.to_f
    else
      @data[:value] = xml_node['value'].strip.to_i
    end

  end

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sistrix::Record