Class: NeptuneApex::Datalog
- Inherits:
-
Object
- Object
- NeptuneApex::Datalog
- Defined in:
- lib/neptune_apex/datalog.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
Returns the value of attribute records.
Instance Method Summary collapse
-
#initialize ⇒ Datalog
constructor
A new instance of Datalog.
- #read_xml(xml) ⇒ Object
Constructor Details
#initialize ⇒ Datalog
Returns a new instance of Datalog.
7 8 9 |
# File 'lib/neptune_apex/datalog.rb', line 7 def initialize @records = {} end |
Instance Attribute Details
#records ⇒ Object
Returns the value of attribute records.
5 6 7 |
# File 'lib/neptune_apex/datalog.rb', line 5 def records @records end |
Instance Method Details
#read_xml(xml) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/neptune_apex/datalog.rb', line 12 def read_xml(xml) doc = Nokogiri::XML(xml) doc.xpath('//datalog/record').each{|record| stat = Status.new record.xpath('./probe').each{|probe| stat.add_probe( probe.at_xpath('./name').text, probe.at_xpath('./value').text, probe.at_xpath('./type').text ) } @records[record.at_xpath('./date').text] = stat } end |