class CwCardUtils::DecklistParser::Card
Public: A single card entry in a deck. 日本語: デッキ内の1枚のカードを表します。
Attributes
Public: Data source used for lookup. 日本語: 参照に用いるデータソース。@return [CwCardUtils::CardDataSource, nil]
Public: Number of copies in the deck. 日本語: デッキ内の枚数。@return [Integer]
Public Class Methods
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 15 def initialize(name, count, cmc_data_source = nil) @name = name @count = count @tags = [] @cmc_data_source = cmc_data_source || CwCardUtils.card_data_source end
Public: Create a card entry. 日本語: カードエントリを作成します。
@param name [String] @param count [Integer] @param cmc_data_source [CwCardUtils::CardDataSource, nil] @return [void]
Public Instance Methods
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 46 def cmc @cmc ||= @cmc_data_source&.cmc_for_card(@name) end
Public: Converted mana cost from the data source. 日本語: データソースから取得した点数で見たマナ・コスト。
@return [Numeric, nil]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 94 def color_identity @color_identity ||= @cmc_data_source&.color_identity_for_card(@name) || [] end
Public: Color identity array from the data source. 日本語: データソースから取得した色アイデンティティ配列。
@return [Array<String>]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 102 def inspect "<Card: #{@name} (#{@count}) #{cmc}>" end
Public: Human-readable summary. 日本語: 人間が読みやすい概要。
@return [String]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 62 def keywords @keywords ||= @cmc_data_source&.keywords_for_card(@name) || [] end
Public: Keywords from the data source. 日本語: データソースから取得したキーワード。
@return [Array<String>]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 70 def oracle_text @oracle_text ||= @cmc_data_source&.oracle_text_for_card(@name) end
Public: Oracle text from the data source. 日本語: データソースから取得したオラクルテキスト。
@return [String, nil]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 78 def power @power ||= @cmc_data_source&.power_for_card(@name) end
Public: Power from the data source. 日本語: データソースから取得したパワー。
@return [String, Integer, nil]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 110 def to_h { name: @name, count: @count, cmc: cmc, type: type, keywords: keywords, power: power, toughness: toughness, oracle_text: oracle_text } end
Public: Serialize to a Hash. 日本語: Hash へシリアライズします。
@return [Hash]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 118 def to_json(*_args) to_h.to_json end
Public: JSON representation. 日本語: JSON 文字列を返します。
@return [String]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 86 def toughness @toughness ||= @cmc_data_source&.toughness_for_card(@name) end
Public: Toughness from the data source. 日本語: データソースから取得したタフネス。
@return [String, Integer, nil]
Source
# File lib/cw_card_utils/decklist_parser/card.rb, line 54 def type @type ||= @cmc_data_source&.type_for_card(@name) || "Land" end
Public: Type line from the data source. 日本語: データソースから取得したタイプ行。
@return [String]