Class: Mensa::Fare
- Inherits:
-
Object
- Object
- Mensa::Fare
- Defined in:
- lib/mensa/fare.rb
Constant Summary collapse
- TYPES =
{ 'S' => :pork, 'R' => :beef, 'RS' => :mixed, 'K' => :veal, 'L' => :lamb, 'G' => :poultry, 'F' => :fish, 'FL' => :meatless }
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, type = nil, price = nil) ⇒ Fare
constructor
A new instance of Fare.
- #inspect ⇒ Object
Constructor Details
#initialize(name, type = nil, price = nil) ⇒ Fare
Returns a new instance of Fare.
20 21 22 23 24 |
# File 'lib/mensa/fare.rb', line 20 def initialize(name, type = nil, price = nil) self.name = name self.type = type self.price = price end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/mensa/fare.rb', line 16 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
18 19 20 |
# File 'lib/mensa/fare.rb', line 18 def price @price end |
#type ⇒ Object
Returns the value of attribute type.
17 18 19 |
# File 'lib/mensa/fare.rb', line 17 def type @type end |
Instance Method Details
#==(other) ⇒ Object
80 81 82 83 84 |
# File 'lib/mensa/fare.rb', line 80 def ==(other) self.name == other.name && self.type == other.type && self.price == other.price end |
#inspect ⇒ Object
86 87 88 |
# File 'lib/mensa/fare.rb', line 86 def inspect "Fare(#{name.inspect}, #{type.inspect}, #{price})" end |