Class: BookwormBuddy::Category
- Inherits:
-
Object
- Object
- BookwormBuddy::Category
- Defined in:
- lib/bookworm_buddy/category.rb
Constant Summary collapse
- ALL =
[]
Instance Attribute Summary collapse
-
#bestsellers ⇒ Object
Returns the value of attribute bestsellers.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(category_hash) ⇒ Category
constructor
A new instance of Category.
Constructor Details
Instance Attribute Details
#bestsellers ⇒ Object
Returns the value of attribute bestsellers.
2 3 4 |
# File 'lib/bookworm_buddy/category.rb', line 2 def bestsellers @bestsellers end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/bookworm_buddy/category.rb', line 2 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/bookworm_buddy/category.rb', line 2 def url @url end |
Class Method Details
.create(category_array) ⇒ Object
10 11 12 |
# File 'lib/bookworm_buddy/category.rb', line 10 def self.create(category_array) category_array.each {|category| self.new(category)} end |
.list_categories ⇒ Object
14 15 16 |
# File 'lib/bookworm_buddy/category.rb', line 14 def self.list_categories ALL.each_with_index {|category, index| puts "#{index+1}. #{category.name}"} end |