class CwCardUtils::DecklistParser::Card

A Card is a single card in a deck.

def cmc

def cmc
  @cmc ||= @cmc_data_source&.cmc_for_card(@name)
end

def color_identity

def color_identity
  @color_identity ||= @cmc_data_source&.color_identity_for_card(@name) || []
end

def initialize(name, count, cmc_data_source = nil)

def initialize(name, count, cmc_data_source = nil)
  @name = name
  @count = count
  @tags = []
  @cmc_data_source = cmc_data_source || CwCardUtils.card_data_source
end

def inspect

def inspect
  "<Card: #{@name} (#{@count}) #{cmc}>"
end

def keywords

def keywords
  @keywords ||= @cmc_data_source&.keywords_for_card(@name) || []
end

def oracle_text

def oracle_text
  @oracle_text ||= @cmc_data_source&.oracle_text_for_card(@name)
end

def power

def power
  @power ||= @cmc_data_source&.power_for_card(@name)
end

def to_h

def to_h
  { name: @name, count: @count, cmc: cmc, type: type, keywords: keywords, power: power, toughness: toughness, oracle_text: oracle_text }
end

def to_json(*_args)

def to_json(*_args)
  to_h.to_json
end

def toughness

def toughness
  @toughness ||= @cmc_data_source&.toughness_for_card(@name)
end

def type

def type
  @type ||= @cmc_data_source&.type_for_card(@name) || "Land"
end