Class: Tea
- Inherits:
-
Object
- Object
- Tea
- Defined in:
- lib/coffee_drinks/tea.rb
Constant Summary collapse
- @@all =
[]
- @@all_sorted =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#flavor ⇒ Object
Returns the value of attribute flavor.
-
#name ⇒ Object
Returns the value of attribute name.
-
#varieties ⇒ Object
Returns the value of attribute varieties.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, description = nil, flavor = nil, varieties = nil) ⇒ Tea
constructor
A new instance of Tea.
Constructor Details
#initialize(name, description = nil, flavor = nil, varieties = nil) ⇒ Tea
Returns a new instance of Tea.
8 9 10 11 12 13 14 |
# File 'lib/coffee_drinks/tea.rb', line 8 def initialize (name, description = nil, flavor = nil, varieties = nil) @name = name @description = description @flavor = flavor @varieties = varieties @@all << self end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/coffee_drinks/tea.rb', line 6 def description @description end |
#flavor ⇒ Object
Returns the value of attribute flavor.
6 7 8 |
# File 'lib/coffee_drinks/tea.rb', line 6 def flavor @flavor end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/coffee_drinks/tea.rb', line 6 def name @name end |
#varieties ⇒ Object
Returns the value of attribute varieties.
6 7 8 |
# File 'lib/coffee_drinks/tea.rb', line 6 def varieties @varieties end |
Class Method Details
.all ⇒ Object
16 17 18 |
# File 'lib/coffee_drinks/tea.rb', line 16 def self.all @@all end |
.sorted_all ⇒ Object
20 21 22 23 |
# File 'lib/coffee_drinks/tea.rb', line 20 def self.sorted_all self.all.sort_by {|tea| tea.name}.each {|instance| @@all_sorted << instance } @@all_sorted end |