Class: Gatherer::Card

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

Constant Summary collapse

COLOR_SYMBOLS =
{
  "Variable Colorless" => "X",
  "White" => "W",
  "Blue" => "U",
  "Black" => "B",
  "Red" => "R",
  "Green" => "G",
  "White or Blue" => "(W/U)",
  "White or Black" => "(W/B)",
  "White or Red" => "(W/R)",
  "White or Green" => "(W/G)",
  "Blue or White" => "(U/W)",
  "Blue or Black" => "(U/B)",
  "Blue or Red" => "(U/R)",
  "Blue or Green" => "(U/G)",
  "Black or White" => "(B/W)",
  "Black or Blue" => "(B/U)",
  "Black or Green" => "(B/G)",
  "Black or Red" => "(B/R)",
  "Red or White" => "(R/W)",
  "Red or Blue" => "(R/U)",
  "Red or Black" => "(R/B)",
  "Red or Green" => "(R/G)",
  "Green or White" => "(G/W)",
  "Green or Blue" => "(G/U)",
  "Green or Black" => "(G/B)",
  "Green or Red" => "(G/R)"
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Card

Returns a new instance of Card.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/gatherer/card.rb', line 49

def initialize(attributes = {})
  @title = attributes[:title]
  @types = attributes[:types]
  @mana_cost = attributes[:mana_cost]
  @converted_mana_cost = attributes[:converted_mana_cost]
  @subtypes = attributes[:subtypes]
  @text = attributes[:text]
  @flavor_text = attributes[:flavor_text]
  @printings = attributes[:printings]
  @power = attributes[:power]
  @toughness = attributes[:toughness]
  @loyalty = attributes[:loyalty]
  @illustrator = attributes[:illustrator]
end

Instance Attribute Details

#converted_mana_costObject (readonly)

Returns the value of attribute converted_mana_cost.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def converted_mana_cost
  @converted_mana_cost
end

#flavor_textObject (readonly)

Returns the value of attribute flavor_text.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def flavor_text
  @flavor_text
end

#illustratorObject (readonly)

Returns the value of attribute illustrator.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def illustrator
  @illustrator
end

#loyaltyObject (readonly)

Returns the value of attribute loyalty.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def loyalty
  @loyalty
end

#mana_costObject (readonly)

Returns the value of attribute mana_cost.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def mana_cost
  @mana_cost
end

#powerObject (readonly)

Returns the value of attribute power.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def power
  @power
end

#printingsObject (readonly)

Returns the value of attribute printings.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def printings
  @printings
end

#subtypesObject (readonly)

Returns the value of attribute subtypes.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def subtypes
  @subtypes
end

#textObject (readonly)

Returns the value of attribute text.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def text
  @text
end

#titleObject (readonly)

Returns the value of attribute title.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def title
  @title
end

#toughnessObject (readonly)

Returns the value of attribute toughness.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def toughness
  @toughness
end

#typesObject (readonly)

Returns the value of attribute types.



36
37
38
# File 'lib/gatherer/card.rb', line 36

def types
  @types
end

Class Method Details

.new_from_parser(parser) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/gatherer/card.rb', line 64

def self.new_from_parser(parser)
  new(
    title: parser.title,
    types: parser.types,
    mana_cost: parser.mana_cost,
    converted_mana_cost: parser.converted_mana_cost,
    subtypes: parser.subtypes,
    text: parser.text,
    flavor_text: parser.flavor_text,
    printings: parser.printings,
    power: parser.power,
    toughness: parser.toughness,
    loyalty: parser.loyalty,
    number: parser.number,
    illustrator: parser.illustrator
  )
end