Class: FAA::Airport::Closure

Inherits:
Object
  • Object
show all
Defined in:
lib/faa/airport/closure.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#airport_idObject

Returns the value of attribute airport_id.



3
4
5
# File 'lib/faa/airport/closure.rb', line 3

def airport_id
  @airport_id
end

#reasonObject

Returns the value of attribute reason.



3
4
5
# File 'lib/faa/airport/closure.rb', line 3

def reason
  @reason
end

#reopenObject

Returns the value of attribute reopen.



3
4
5
# File 'lib/faa/airport/closure.rb', line 3

def reopen
  @reopen
end

#startObject

Returns the value of attribute start.



3
4
5
# File 'lib/faa/airport/closure.rb', line 3

def start
  @start
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
# File 'lib/faa/airport/closure.rb', line 6

def self.from_xml(root)
  closures = []
  
  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 'Start'
        delay.start = child.content.strip
      when 'Reopen'
        delay.reopen = child.content.strip
      end
    end
    closures << delay
  end
  closures
end