Class: Content
- Inherits:
-
Object
- Object
- Content
- Defined in:
- lib/manasimu/card.rb
Instance Attribute Summary collapse
-
#color_identity ⇒ Object
Returns the value of attribute color_identity.
-
#converted_mana_cost ⇒ Object
Returns the value of attribute converted_mana_cost.
-
#mana_cost ⇒ Object
Returns the value of attribute mana_cost.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#set_code ⇒ Object
Returns the value of attribute set_code.
-
#side ⇒ Object
Returns the value of attribute side.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Returns the value of attribute type.
-
#types ⇒ Object
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Content
constructor
A new instance of Content.
- #mana_source? ⇒ Boolean
- #to_factory ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ Content
Returns a new instance of Content.
417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/manasimu/card.rb', line 417 def initialize(hash) @name = hash[:name] @number = hash[:number] @side = hash[:side] @set_code = hash[:set_code] @mana_cost = hash[:mana_cost] @types = hash[:types] @type = hash[:type] @text = hash[:text] @color_identity = hash[:color_identity] @converted_mana_cost = hash[:converted_mana_cost].to_i end |
Instance Attribute Details
#color_identity ⇒ Object
Returns the value of attribute color_identity.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def color_identity @color_identity end |
#converted_mana_cost ⇒ Object
Returns the value of attribute converted_mana_cost.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def converted_mana_cost @converted_mana_cost end |
#mana_cost ⇒ Object
Returns the value of attribute mana_cost.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def mana_cost @mana_cost end |
#name ⇒ Object
Returns the value of attribute name.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def number @number end |
#set_code ⇒ Object
Returns the value of attribute set_code.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def set_code @set_code end |
#side ⇒ Object
Returns the value of attribute side.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def side @side end |
#text ⇒ Object
Returns the value of attribute text.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def text @text end |
#type ⇒ Object
Returns the value of attribute type.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def type @type end |
#types ⇒ Object
Returns the value of attribute types.
415 416 417 |
# File 'lib/manasimu/card.rb', line 415 def types @types end |
Instance Method Details
#mana_source? ⇒ Boolean
430 431 432 |
# File 'lib/manasimu/card.rb', line 430 def mana_source? return @types == "Land" end |
#to_factory ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/manasimu/card.rb', line 438 def to_factory <<EOF factory '#{@name.underscore}_content', class: Content do name {'#{@name}'} number {'#{@number}'} side {'#{@side}'} set_code { '#{@set_code}'} mana_cost { '#{@mana_cost}'} type { '#{@type}'} types { '#{@types}'} text { '#{@text}'} color_identity { '#{@color_identity}'} converted_mana_cost {#{@converted_mana_cost}} end EOF end |
#to_s ⇒ Object
434 435 436 |
# File 'lib/manasimu/card.rb', line 434 def to_s "[#{@name}] [#{@types}] [#{@color_identity}] [#{@mana_cost}]" end |