Class: MtgRb::Printing
- Inherits:
-
Object
- Object
- MtgRb::Printing
- Defined in:
- lib/mtg_rb/printing.rb
Overview
This joins some ideas together in “concrete” piece of paper.
-
Card
-
Expansion
-
Artist
Some attributes come in “Cards” from MTGJSON but really belong to the printing.
-
Number
-
Flavor text
-
Artist
-
Rarity
-
?? others?
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#card ⇒ Object
readonly
Returns the value of attribute card.
-
#expansion ⇒ Object
readonly
Returns the value of attribute expansion.
-
#flavor ⇒ Object
readonly
Returns the value of attribute flavor.
-
#multiverseid ⇒ Object
readonly
Returns the value of attribute multiverseid.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#rarity ⇒ Object
readonly
Returns the value of attribute rarity.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(card:, expansion:, artist:, flavor:, rarity:, number:, multiverseid:) ⇒ Printing
constructor
A new instance of Printing.
Constructor Details
#initialize(card:, expansion:, artist:, flavor:, rarity:, number:, multiverseid:) ⇒ Printing
Returns a new instance of Printing.
31 32 33 34 35 36 37 38 39 |
# File 'lib/mtg_rb/printing.rb', line 31 def initialize(card:, expansion:, artist:, flavor:, rarity:, number:, multiverseid:) @card = card @expansion = expansion @artist = artist @flavor = flavor @rarity = rarity @number = number @multiverseid = multiverseid end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def artist @artist end |
#card ⇒ Object (readonly)
Returns the value of attribute card.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def card @card end |
#expansion ⇒ Object (readonly)
Returns the value of attribute expansion.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def expansion @expansion end |
#flavor ⇒ Object (readonly)
Returns the value of attribute flavor.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def flavor @flavor end |
#multiverseid ⇒ Object (readonly)
Returns the value of attribute multiverseid.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def multiverseid @multiverseid end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def number @number end |
#rarity ⇒ Object (readonly)
Returns the value of attribute rarity.
29 30 31 |
# File 'lib/mtg_rb/printing.rb', line 29 def rarity @rarity end |
Class Method Details
.from_card_hash(expansion:, card:, artist:, card_hash:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mtg_rb/printing.rb', line 14 def self.from_card_hash(expansion:, card:, artist:, card_hash:) self.new( card: card, expansion: expansion, artist: artist, flavor: card_hash.fetch("flavor", ""), rarity: card_hash.fetch("rarity"), number: card_hash.fetch("number", nil), multiverseid: card_hash.fetch("multiverseid", nil), ) rescue KeyError => err p err p card_hash end |