Exception: RuneterraCards::MetadataLoadError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/runeterra_cards/errors.rb

Overview

This exception is raised if you try to parse data from Runeterra Data Dragon that is not in the expected form. The message will tell you what data was not right, and the #card attribute will tell you which card had issues, if possible.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card, problem) ⇒ MetadataLoadError

Returns a new instance of MetadataLoadError.



72
73
74
75
76
77
78
79
# File 'lib/runeterra_cards/errors.rb', line 72

def initialize(card, problem)
  if card.nil?
    super("Error loading data for unknown card (no code or name): #{problem}")
  else
    super("Error loading data for card #{card}: #{problem}")
  end
  @card = card
end

Instance Attribute Details

#cardString? (readonly)

Return the name or card code of the card that was missing an expected attribute.

Returns:

  • (String)

    name if the name was present

  • (String)

    card code if the name was not present

  • (nil)

    if neither name nor card code were present



70
71
72
# File 'lib/runeterra_cards/errors.rb', line 70

def card
  @card
end