class MtgRb::Printing

This joins some ideas together in “concrete” piece of paper.

Some attributes come in “Cards” from MTGJSON but really belong to the printing.

Attributes

artist[R]
card[R]
expansion[R]
flavor[R]
multiverseid[R]
number[R]
rarity[R]

Public Class Methods

from_card_hash(expansion:, card:, artist:, card_hash:) click to toggle source
# 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
new(card:, expansion:, artist:, flavor:, rarity:, number:, multiverseid:) click to toggle source
# 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