Sha256: 50dd37fef32482d3584d45e62265cfd2307fa8dca08412f38ff2f1113e6b4787

Contents?: true

Size: 680 Bytes

Versions: 4

Compression:

Stored size: 680 Bytes

Contents

require_relative '../concerns/persistable'
class ModernRise
  include Persistable::InstanceMethods
  extend Persistable::ClassMethods

  #metaprogramming the hash to convert keys to attr_accessor's and also for inserting the values to the sql strings
  ATTRS = {
    :id => "INTEGER PRIMARY KEY",
    :card => "TEXT",
    :sets => "TEXT",
    :market_price => "INTEGER",
    :price_fluctuate => "TEXT",
    :image => "TEXT"
  }

  #reader that can be accessed by Persistable module to know the unique class's constant
  def self.attributes
    ATTRS
  end

  #abstracting the collection of keys into attributes
  self.attributes.keys.each do |key|
    attr_accessor key
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mtg-card-finder-0.1.4 lib/mtg_card_finder/tables/modern_rise.rb
mtg-card-finder-0.1.3 lib/mtg_card_finder/tables/modern_rise.rb
mtg-card-finder-0.1.1 lib/mtg_card_finder/tables/modern_rise.rb
mtg-card-finder-0.1.0 lib/mtg_card_finder/tables/modern_rise.rb