Class: DublinBikes::StationStatus
- Inherits:
-
Object
- Object
- DublinBikes::StationStatus
- Defined in:
- lib/dublin_bikes/station_status.rb
Instance Attribute Summary collapse
-
#available_bikes ⇒ Object
readonly
Returns the value of attribute available_bikes.
-
#free_spaces ⇒ Object
readonly
Returns the value of attribute free_spaces.
-
#total_capacity ⇒ Object
readonly
Returns the value of attribute total_capacity.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #accepts_credit_card? ⇒ Boolean
- #closed? ⇒ Boolean
-
#initialize(station) ⇒ StationStatus
constructor
A new instance of StationStatus.
- #open? ⇒ Boolean
Constructor Details
#initialize(station) ⇒ StationStatus
Returns a new instance of StationStatus.
5 6 7 8 9 10 11 12 |
# File 'lib/dublin_bikes/station_status.rb', line 5 def initialize(station) @available_bikes = station.available @free_spaces = station.free @total_capacity = station.total @open = station.open == 1 ? true : false @accepts_credit_card = station.ticket == 1 ? true : false @updated_at = Time.at(station.updated) end |
Instance Attribute Details
#available_bikes ⇒ Object (readonly)
Returns the value of attribute available_bikes.
3 4 5 |
# File 'lib/dublin_bikes/station_status.rb', line 3 def available_bikes @available_bikes end |
#free_spaces ⇒ Object (readonly)
Returns the value of attribute free_spaces.
3 4 5 |
# File 'lib/dublin_bikes/station_status.rb', line 3 def free_spaces @free_spaces end |
#total_capacity ⇒ Object (readonly)
Returns the value of attribute total_capacity.
3 4 5 |
# File 'lib/dublin_bikes/station_status.rb', line 3 def total_capacity @total_capacity end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/dublin_bikes/station_status.rb', line 3 def updated_at @updated_at end |
Instance Method Details
#accepts_credit_card? ⇒ Boolean
22 23 24 |
# File 'lib/dublin_bikes/station_status.rb', line 22 def accepts_credit_card? @accepts_credit_card end |
#closed? ⇒ Boolean
18 19 20 |
# File 'lib/dublin_bikes/station_status.rb', line 18 def closed? !open? end |
#open? ⇒ Boolean
14 15 16 |
# File 'lib/dublin_bikes/station_status.rb', line 14 def open? @open end |