Class: NationalRail::VirginLiveDepartureBoards::SummaryRow

Inherits:
Object
  • Object
show all
Defined in:
lib/national-rail/virgin_live_departure_boards.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent, details_link, attributes) ⇒ SummaryRow

Returns a new instance of SummaryRow.



60
61
62
# File 'lib/national-rail/virgin_live_departure_boards.rb', line 60

def initialize(agent, details_link, attributes)
  @agent, @details_link, @attributes = agent, details_link, attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



58
59
60
# File 'lib/national-rail/virgin_live_departure_boards.rb', line 58

def attributes
  @attributes
end

Instance Method Details

#[](key) ⇒ Object



64
65
66
# File 'lib/national-rail/virgin_live_departure_boards.rb', line 64

def [](key)
  @attributes[key]
end

#detailsObject



68
69
70
71
72
73
74
75
# File 'lib/national-rail/virgin_live_departure_boards.rb', line 68

def details
  @agent.transact do
    page = @details_link.click
    VirginLiveDepartureBoards.capture(page, @details_link.href)
    parser = DetailsPageParser.new(page.doc)
    parser.parse
  end
end