Class: ExtraSpace::Rates
- Inherits:
-
Object
- Object
- ExtraSpace::Rates
- Defined in:
- lib/extraspace/rates.rb
Overview
The rates (street + web) for a facility
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(street:, web:) ⇒ Rates
constructor
A new instance of Rates.
- #inspect ⇒ String
-
#text ⇒ String
E.g.
Constructor Details
#initialize(street:, web:) ⇒ Rates
Returns a new instance of Rates.
26 27 28 29 |
# File 'lib/extraspace/rates.rb', line 26 def initialize(street:, web:) @street = street @web = web end |
Instance Attribute Details
#street ⇒ Integer
8 9 10 |
# File 'lib/extraspace/rates.rb', line 8 def street @street end |
#web ⇒ Integer
12 13 14 |
# File 'lib/extraspace/rates.rb', line 12 def web @web end |
Class Method Details
.parse(data:) ⇒ Rates
17 18 19 20 21 22 |
# File 'lib/extraspace/rates.rb', line 17 def self.parse(data:) new( street: data['street'], web: data['web'] ) end |
Instance Method Details
#inspect ⇒ String
32 33 34 35 36 37 38 |
# File 'lib/extraspace/rates.rb', line 32 def inspect props = [ "street=#{@street.inspect}", "web=#{@web.inspect}" ] "#<#{self.class.name} #{props.join(' ')}>" end |
#text ⇒ String
Returns e.g. “$80 (street) | $60 (web)”.
41 42 43 |
# File 'lib/extraspace/rates.rb', line 41 def text "$#{@street} (street) | $#{@web} (web)" end |