Class: Content

Inherits:
Object
  • Object
show all
Defined in:
lib/manasimu/card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Content

Returns a new instance of Content.



464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/manasimu/card.rb', line 464

def initialize(hash)
  @name = hash[:name]
  @names = hash[:names]
  @number = hash[:number].to_i
  @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_identityObject

Returns the value of attribute color_identity.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def color_identity
  @color_identity
end

#converted_mana_costObject

Returns the value of attribute converted_mana_cost.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def converted_mana_cost
  @converted_mana_cost
end

#mana_costObject

Returns the value of attribute mana_cost.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def mana_cost
  @mana_cost
end

#nameObject

Returns the value of attribute name.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def name
  @name
end

#namesObject

Returns the value of attribute names.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def names
  @names
end

#numberObject

Returns the value of attribute number.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def number
  @number
end

#set_codeObject

Returns the value of attribute set_code.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def set_code
  @set_code
end

#sideObject

Returns the value of attribute side.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def side
  @side
end

#textObject

Returns the value of attribute text.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def text
  @text
end

#typeObject

Returns the value of attribute type.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def type
  @type
end

#typesObject

Returns the value of attribute types.



462
463
464
# File 'lib/manasimu/card.rb', line 462

def types
  @types
end

Instance Method Details

#mana_source?Boolean

Returns:

  • (Boolean)


478
479
480
# File 'lib/manasimu/card.rb', line 478

def mana_source?
  return @types.include? "Land"
end

#to_factoryObject



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/manasimu/card.rb', line 486

def to_factory
  <<EOF
factory '#{@name.underscore}_content', class: Content do
  name  {'#{@name}'}
  names  {'#{@names}'}
  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_sObject



482
483
484
# File 'lib/manasimu/card.rb', line 482

def to_s
  "[#{@name}] [#{@names}] [#{@types}] [#{@color_identity}] [#{@mana_cost}]"
end