class QueryMtg

Attributes

argv[R]
no_cache[R]

Public Class Methods

call(argv) click to toggle source
# File lib/query_mtg.rb, line 9
def self.call(argv)
  new(argv).call
end
new(argv) click to toggle source
# File lib/query_mtg.rb, line 23
def initialize(argv)
  @no_cache = argv.delete('--no-cache')
  @argv = argv
end

Public Instance Methods

call() click to toggle source
# File lib/query_mtg.rb, line 13
def call
  puts requested_cards
rescue Query::RepeatedFilter, CardsManager::InvalidValue, CardsManager::UnknownAttribute => e
  puts e.message
end

Private Instance Methods

cards_source() click to toggle source
# File lib/query_mtg.rb, line 36
def cards_source
  Cards.get(no_cache)
end
query() click to toggle source
# File lib/query_mtg.rb, line 32
def query
  Query.new(argv).build
end
requested_cards() click to toggle source
# File lib/query_mtg.rb, line 28
def requested_cards
  CardsManager.new(query, cards_source).requested_cards
end