Class: CtaTrack::RouteFactory
- Inherits:
-
Object
- Object
- CtaTrack::RouteFactory
- Defined in:
- lib/routes.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(**args) ⇒ RouteFactory
constructor
A new instance of RouteFactory.
Constructor Details
#initialize(**args) ⇒ RouteFactory
Returns a new instance of RouteFactory.
4 5 6 7 8 9 10 |
# File 'lib/routes.rb', line 4 def initialize(**args) raise ArgumentError, "must enter api key" if API.apikey.nil? @result = {} API.routes.root.xpath("route").each do |node| @result[node.xpath('rt').text] = Route.new({:number=> node.xpath('rt').text, :name=> node.xpath('rtnm').text}) end end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
3 4 5 |
# File 'lib/routes.rb', line 3 def result @result end |