Class: ExtraSpace::Price
- Inherits:
-
Object
- Object
- ExtraSpace::Price
- Defined in:
- lib/extraspace/price.rb
Overview
The price (id + dimensions + rate) for a facility
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, dimensions:, features:, rates:) ⇒ Price
constructor
A new instance of Price.
- #inspect ⇒ String
-
#text ⇒ String
E.g.
Constructor Details
#initialize(id:, dimensions:, features:, rates:) ⇒ Price
Returns a new instance of Price.
38 39 40 41 42 43 |
# File 'lib/extraspace/price.rb', line 38 def initialize(id:, dimensions:, features:, rates:) @id = id @dimensions = dimensions @features = features @rates = rates end |
Instance Attribute Details
#dimensions ⇒ Dimensions
12 13 14 |
# File 'lib/extraspace/price.rb', line 12 def dimensions @dimensions end |
#id ⇒ String
8 9 10 |
# File 'lib/extraspace/price.rb', line 8 def id @id end |
Class Method Details
Instance Method Details
#inspect ⇒ String
46 47 48 49 50 51 52 53 54 |
# File 'lib/extraspace/price.rb', line 46 def inspect props = [ "id=#{@id.inspect}", "dimensions=#{@dimensions.inspect}", "features=#{@features.inspect}", "rates=#{@rates.inspect}" ] "#<#{self.class.name} #{props.join(' ')}>" end |
#text ⇒ String
Returns e.g. “123 | 5’ × 5’ (25 sqft) | $100 (street) / $90 (web)”.
57 58 59 |
# File 'lib/extraspace/price.rb', line 57 def text "#{@id} | #{@dimensions.text} | #{@rates.text}" end |