Class: ManaType
- Inherits:
-
Object
- Object
- ManaType
- Defined in:
- lib/manasimu/mana_type.rb
Defined Under Namespace
Classes: Black, Blue, Green, Red, White
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#land_type ⇒ Object
Returns the value of attribute land_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(color, land_type) ⇒ ManaType
constructor
A new instance of ManaType.
Constructor Details
#initialize(color, land_type) ⇒ ManaType
Returns a new instance of ManaType.
4 5 6 7 |
# File 'lib/manasimu/mana_type.rb', line 4 def initialize(color, land_type) @land_type = land_type @color = color end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
2 3 4 |
# File 'lib/manasimu/mana_type.rb', line 2 def color @color end |
#land_type ⇒ Object
Returns the value of attribute land_type.
2 3 4 |
# File 'lib/manasimu/mana_type.rb', line 2 def land_type @land_type end |
Class Method Details
.all ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/manasimu/mana_type.rb', line 9 def self.all r ||= Red.new u ||= Blue.new g ||= Green.new w ||= White.new b ||= Black.new @@all ||= [r, u, g, w, b] end |
.search_text_by_color(text) ⇒ Object
24 25 26 27 28 |
# File 'lib/manasimu/mana_type.rb', line 24 def self.search_text_by_color(text) self.all.select do |mana_type| text.include? mana_type.color end end |
.search_text_by_land_type(text) ⇒ Object
18 19 20 21 22 |
# File 'lib/manasimu/mana_type.rb', line 18 def self.search_text_by_land_type(text) self.all.select do |mana_type| text.include? mana_type.land_type end end |