Class: Compactor::Amazon::XmlParser

Inherits:
Object
  • Object
show all
Defined in:
lib/compactor/xml_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ XmlParser

Returns a new instance of XmlParser.



5
6
7
# File 'lib/compactor/xml_parser.rb', line 5

def initialize(xml)
  calculate(Nokogiri::XML::Document.parse(xml))
end

Instance Attribute Details

#calculated_totalObject (readonly)

Returns the value of attribute calculated_total.



4
5
6
# File 'lib/compactor/xml_parser.rb', line 4

def calculated_total
  @calculated_total
end

#expected_totalObject (readonly)

Returns the value of attribute expected_total.



4
5
6
# File 'lib/compactor/xml_parser.rb', line 4

def expected_total
  @expected_total
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/compactor/xml_parser.rb', line 9

def valid?
  (expected_total.abs - calculated_total.abs).abs < 0.009
end