Class: Mensa::Fare

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/mensa/fare.rb', line 16

def name
  @name
end

#priceObject

Returns the value of attribute price.



18
19
20
# File 'lib/mensa/fare.rb', line 18

def price
  @price
end

#typeObject

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

#inspectObject



86
87
88
# File 'lib/mensa/fare.rb', line 86

def inspect
  "Fare(#{name.inspect}, #{type.inspect}, #{price})"
end