Class: Category
- Inherits:
-
Object
- Object
- Category
- Defined in:
- lib/category.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#teas ⇒ Object
Returns the value of attribute teas.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Category
constructor
A new instance of Category.
Constructor Details
#initialize(name) ⇒ Category
Returns a new instance of Category.
9 10 11 12 13 |
# File 'lib/category.rb', line 9 def initialize(name) @name = name @teas = [] @@all << self end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/category.rb', line 5 def name @name end |
#teas ⇒ Object
Returns the value of attribute teas.
6 7 8 |
# File 'lib/category.rb', line 6 def teas @teas end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/category.rb', line 6 def url @url end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/category.rb', line 15 def self.all @@all end |
.check_for_category(category_name) ⇒ Object
19 20 21 |
# File 'lib/category.rb', line 19 def self.check_for_category(category_name) self.all.detect { |cat| cat.name == category_name } end |