Class: FAA::Delay::GroundDelay

Inherits:
FAA::Delay show all
Defined in:
lib/faa/delay/ground_delay.rb

Instance Attribute Summary collapse

Attributes inherited from FAA::Delay

#airport_id, #reason

Class Method Summary collapse

Instance Attribute Details

#averageObject

Returns the value of attribute average.



3
4
5
# File 'lib/faa/delay/ground_delay.rb', line 3

def average
  @average
end

#maximumObject

Returns the value of attribute maximum.



3
4
5
# File 'lib/faa/delay/ground_delay.rb', line 3

def maximum
  @maximum
end

Class Method Details

.from_xml(root) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/faa/delay/ground_delay.rb', line 5

def self.from_xml(root)
  delays = []
  
  root.children.each do |node|
    delay = new
    node.children.each do |child|
      case child.name
      when 'ARPT'
        delay.airport_id = child.content.strip
      when 'Reason'
        delay.reason = child.content.strip
      when 'Avg'
        delay.average = child.content
      when 'Max'
        delay.maximum = child.content
      end
    end
    delays << delay
  end
  delays
end