Class: Category

Inherits:
Object
  • Object
show all
Defined in:
lib/category.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/category.rb', line 5

def name
  @name
end

#teasObject

Returns the value of attribute teas.



6
7
8
# File 'lib/category.rb', line 6

def teas
  @teas
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/category.rb', line 6

def url
  @url
end

Class Method Details

.allObject



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