class MTG
Constants
- ATTRIBUTES
Attributes
card[RW]
image[RW]
market_price[RW]
price_fluctuate[RW]
sets[RW]
Public Class Methods
all(format)
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 55 def self.all(format) #iterate through each instance that was appended into class variable during initialization format.each_with_index do |card, number| puts "" puts "|- #{number + 1} -|".fg COLORS[4] puts "" #line below helps resolve glitch that allows 'ghost/invalid' cards to be selected from Parser.purchase if number < Parser.table_length #iterate through each instance method that was defined for the stored instance variable card.instance_variables.each_with_index do |value, index| #returns the value of the instance method applied to the instance #with an index value of the first/last, key/value pairs ordered in Parser.scrape_cards #associates a named definition of the values by titling it from constant ATTRIBUTES if index < 4 puts "#{ATTRIBUTES[index].fg COLORS[2]} #{card.instance_variable_get(value)}" end end end puts "" print " ".bg COLORS[7] end end
create_modern_down(attributes)
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 43 def self.create_modern_down(attributes) cards = MTG.new(attributes).tap {|card| card.save_modern_down} end
create_modern_up(attributes)
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 38 def self.create_modern_up(attributes) #allows cards instance to auto return thanks to tap implementation cards = MTG.new(attributes).tap {|card| card.save_modern_up} end
create_standard_down(attributes)
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 51 def self.create_standard_down(attributes) cards = MTG.new(attributes).tap {|card| card.save_standard_down} end
create_standard_up(attributes)
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 47 def self.create_standard_up(attributes) cards = MTG.new(attributes).tap {|card| card.save_standard_up} end
modern_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 106 def self.modern_down @@modern_down end
modern_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 102 def self.modern_up @@modern_up end
new(attributes)
click to toggle source
new instance will be created with already assigned values to MTG
attrs
# File lib/mtg_card_finder/mtg.rb, line 18 def initialize(attributes) attributes.each {|key, value| self.send("#{key}=", value)} end
search_modern_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 90 def self.search_modern_down self.all(@@modern_down) end
search_modern_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 86 def self.search_modern_up self.all(@@modern_up) end
search_standard_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 98 def self.search_standard_down self.all(@@standard_down) end
search_standard_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 94 def self.search_standard_up self.all(@@standard_up) end
standard_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 114 def self.standard_down @@standard_down end
standard_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 110 def self.standard_up @@standard_up end
store_temp_array(array)
click to toggle source
hack that resolves glitch that would display duplicate recursions in the selected cards to show by user request in CLI.set_input
# File lib/mtg_card_finder/mtg.rb, line 80 def self.store_temp_array(array) @@temp_array = array self.all(@@temp_array) @@temp_array.clear end
Public Instance Methods
save_modern_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 26 def save_modern_down @@modern_down << self end
save_modern_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 22 def save_modern_up @@modern_up << self end
save_standard_down()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 34 def save_standard_down @@standard_down << self end
save_standard_up()
click to toggle source
# File lib/mtg_card_finder/mtg.rb, line 30 def save_standard_up @@standard_up << self end