Method: Deckstrings::Deck.decode
- Defined in:
- lib/deckstrings/deckstrings.rb
.decode(deckstring) ⇒ Deck
Decodes a Hearthstone deckstring into a Deckstrings::Deck with basic hero and card metadata.
This method validates the well-formedness of the deckstring, the embedded version, the format, card counts, and each hero/card ID.
All IDs refer to unique Hearthstone DBF IDs which can be used in conjunction with HearthstoneJSON metadata.
335 336 337 338 339 340 341 342 |
# File 'lib/deckstrings/deckstrings.rb', line 335 def self.decode(deckstring) parts = Deckstrings::decode(deckstring) begin Deck.new(parts) rescue ArgumentError => e raise FormatError, e.to_s end end |