Class: FAA::Delay::AirspaceFlow
- Inherits:
-
Object
- Object
- FAA::Delay::AirspaceFlow
- Defined in:
- lib/faa/delay/airspace_flow.rb
Defined Under Namespace
Classes: Circle, Line, Polygon
Instance Attribute Summary collapse
-
#afp_end_time ⇒ Object
Returns the value of attribute afp_end_time.
-
#afp_start_time ⇒ Object
Returns the value of attribute afp_start_time.
-
#average ⇒ Object
Returns the value of attribute average.
-
#ceiling ⇒ Object
Returns the value of attribute ceiling.
-
#control_element ⇒ Object
Returns the value of attribute control_element.
-
#fca_end_time ⇒ Object
Returns the value of attribute fca_end_time.
-
#fca_start_time ⇒ Object
Returns the value of attribute fca_start_time.
-
#floor ⇒ Object
Returns the value of attribute floor.
-
#reason ⇒ Object
Returns the value of attribute reason.
Class Method Summary collapse
Instance Attribute Details
#afp_end_time ⇒ Object
Returns the value of attribute afp_end_time.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def afp_end_time @afp_end_time end |
#afp_start_time ⇒ Object
Returns the value of attribute afp_start_time.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def afp_start_time @afp_start_time end |
#average ⇒ Object
Returns the value of attribute average.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def average @average end |
#ceiling ⇒ Object
Returns the value of attribute ceiling.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def ceiling @ceiling end |
#control_element ⇒ Object
Returns the value of attribute control_element.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def control_element @control_element end |
#fca_end_time ⇒ Object
Returns the value of attribute fca_end_time.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def fca_end_time @fca_end_time end |
#fca_start_time ⇒ Object
Returns the value of attribute fca_start_time.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def fca_start_time @fca_start_time end |
#floor ⇒ Object
Returns the value of attribute floor.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def floor @floor end |
#reason ⇒ Object
Returns the value of attribute reason.
3 4 5 |
# File 'lib/faa/delay/airspace_flow.rb', line 3 def reason @reason end |
Class Method Details
.from_xml(root) ⇒ Object
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 40 41 42 43 44 45 46 |
# File 'lib/faa/delay/airspace_flow.rb', line 6 def self.from_xml(root) flows = [] root.children.each do |child_flow| flow = case child_flow.children.find { |x| ["Line", "Polygon", "Circle"].include?(x.name) }.name when 'Line' FAA::Delay::AirspaceFlow::Line.from_xml(child_flow.children.find { |x| x.name == 'Line' }) when 'Polygon' FAA::Delay::AirspaceFlow::Polygon.from_xml(child_flow.children.find { |x| x.name == 'Polygon' }) when 'Circle' FAA::Delay::AirspaceFlow::Circle.from_xml(child_flow.children.find { |x| x.name == 'Circle' }) end child_flow.children.each do |node| case node.name when 'CTL_Element' flow.control_element = node.content.strip when 'Reason' flow.reason = node.content.strip when 'FCA_Start_DateTime' flow.fca_start_time = Time.utc(node.content[0..3], node.content[4..5], node.content[6..7], node.content[8..9], node.content[10..11], node.content[12..13]) when 'FCA_End_DateTime' flow.fca_end_time = Time.utc(node.content[0..3], node.content[4..5], node.content[6..7], node.content[8..9], node.content[10..11], node.content[12..13]) when 'AFP_StartTime' flow.afp_start_time = Time.utc(flow.fca_start_time.year, flow.fca_start_time.month, flow.fca_start_time.day, node.content[0..1], node.content[2..3]) flow.afp_start_time += 86400 if flow.afp_start_time < flow.fca_start_time when 'AFP_EndTime' flow.afp_end_time = Time.utc(flow.fca_end_time.year, flow.fca_end_time.month, flow.fca_end_time.day, node.content[0..1], node.content[2..3]) flow.afp_end_time -= 86400 if flow.afp_end_time > flow.fca_end_time when 'Avg' flow.average = node.content.strip when 'Floor' flow.floor = node.content.to_i when 'Ceiling' flow.ceiling = node.content.to_i end end flows << flow end flows end |