Class: CheeseBoard::CheeseType
- Inherits:
-
Object
- Object
- CheeseBoard::CheeseType
- Defined in:
- lib/cheese_board/cheesetype.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#char ⇒ Object
Returns the value of attribute char.
-
#cheeses ⇒ Object
Returns the value of attribute cheeses.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #count ⇒ Object
- #get_cheeses ⇒ Object
-
#initialize(name) ⇒ CheeseType
constructor
A new instance of CheeseType.
- #save ⇒ Object
Constructor Details
#initialize(name) ⇒ CheeseType
Returns a new instance of CheeseType.
5 6 7 8 9 |
# File 'lib/cheese_board/cheesetype.rb', line 5 def initialize(name) @name=name @cheeses=[] save end |
Instance Attribute Details
#char ⇒ Object
Returns the value of attribute char.
3 4 5 |
# File 'lib/cheese_board/cheesetype.rb', line 3 def char @char end |
#cheeses ⇒ Object
Returns the value of attribute cheeses.
3 4 5 |
# File 'lib/cheese_board/cheesetype.rb', line 3 def cheeses @cheeses end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/cheese_board/cheesetype.rb', line 3 def name @name end |
Class Method Details
.all ⇒ Object
11 12 13 14 15 |
# File 'lib/cheese_board/cheesetype.rb', line 11 def self.all CheeseBoard::Scraper.scrape_cheese_types if @@all.empty? @@all end |
Instance Method Details
#count ⇒ Object
25 26 27 |
# File 'lib/cheese_board/cheesetype.rb', line 25 def count @cheese.length end |
#get_cheeses ⇒ Object
17 18 19 |
# File 'lib/cheese_board/cheesetype.rb', line 17 def get_cheeses CheeseBoard::Scraper.scrape_cheeses(self) if @cheeses.empty? end |
#save ⇒ Object
21 22 23 |
# File 'lib/cheese_board/cheesetype.rb', line 21 def save @@all << self end |