Class: RebelLegion::CostumeCategory
- Inherits:
-
Object
- Object
- RebelLegion::CostumeCategory
- Defined in:
- lib/rebel_legion/costume_category.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#costumes ⇒ Object
Returns the value of attribute costumes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #add_costume(costume) ⇒ Object
- #display_costume_names ⇒ Object
-
#initialize(name, url) ⇒ CostumeCategory
constructor
A new instance of CostumeCategory.
Constructor Details
#initialize(name, url) ⇒ CostumeCategory
Returns a new instance of CostumeCategory.
6 7 8 9 10 11 |
# File 'lib/rebel_legion/costume_category.rb', line 6 def initialize(name, url) @name = name @url = url @costumes = [] @@all << self end |
Instance Attribute Details
#costumes ⇒ Object
Returns the value of attribute costumes.
2 3 4 |
# File 'lib/rebel_legion/costume_category.rb', line 2 def costumes @costumes end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/rebel_legion/costume_category.rb', line 2 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/rebel_legion/costume_category.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
13 14 15 |
# File 'lib/rebel_legion/costume_category.rb', line 13 def self.all @@all end |
.display_all_names ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rebel_legion/costume_category.rb', line 17 def self.display_all_names i = 0 @@all.each do |category| i += 1 puts "#{i}. ".colorize(:yellow) + "#{category.name}" end end |
Instance Method Details
#add_costume(costume) ⇒ Object
25 26 27 |
# File 'lib/rebel_legion/costume_category.rb', line 25 def add_costume(costume) @costumes << costume end |
#display_costume_names ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rebel_legion/costume_category.rb', line 29 def display_costume_names i = 0 costumes.each do |costume| i += 1 puts "#{i}. ".colorize(:yellow) + "#{costume.name}" end end |