Class: FAA::Delay::General
- Inherits:
-
FAA::Delay
- Object
- FAA::Delay
- FAA::Delay::General
- Defined in:
- lib/faa/delay/general.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#maximum ⇒ Object
Returns the value of attribute maximum.
-
#minimum ⇒ Object
Returns the value of attribute minimum.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#trend ⇒ Object
Returns the value of attribute trend.
Attributes inherited from FAA::Delay
Class Method Summary collapse
-
.from_xml(root) ⇒ Object
Blame the F***** FAA for this function, who does their crappy xml?.
Instance Attribute Details
#maximum ⇒ Object
Returns the value of attribute maximum.
3 4 5 |
# File 'lib/faa/delay/general.rb', line 3 def maximum @maximum end |
#minimum ⇒ Object
Returns the value of attribute minimum.
3 4 5 |
# File 'lib/faa/delay/general.rb', line 3 def minimum @minimum end |
#reason ⇒ Object
Returns the value of attribute reason.
3 4 5 |
# File 'lib/faa/delay/general.rb', line 3 def reason @reason end |
#trend ⇒ Object
Returns the value of attribute trend.
3 4 5 |
# File 'lib/faa/delay/general.rb', line 3 def trend @trend end |
Class Method Details
.from_xml(root) ⇒ Object
Blame the F***** FAA for this function, who does their crappy xml?
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/faa/delay/general.rb', line 6 def self.from_xml(root) delays = [] root.children.each do |child| delay = case child.children.find { |x| x.name == "Arrival_Departure" }['Type'] when 'Departure' FAA::Delay::GeneralDeparture.new when 'Arrival' FAA::Delay::GeneralArrival.new end child.children.each do |node| case node.name when 'ARPT' delay.airport_id = node.content.strip when 'Reason' delay.reason = node.content.strip when 'Arrival_Departure' node.children.each do |child2| case child2.name when 'Trend' delay.trend = child2.content.strip.downcase when 'Min' delay.minimum = child2.content when 'Max' delay.maximum = child2.content end end end end delays << delay end delays end |