Sha256: 8bd113bd10c0805b7b846c1e2c1d63b3a8460b98be2fa0ab2b3f90ab32bf7ba2

Contents?: true

Size: 682 Bytes

Versions: 4

Compression:

Stored size: 682 Bytes

Contents

require_relative '../concerns/persistable'
class StandardFall
  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/standard_fall.rb
mtg-card-finder-0.1.3 lib/mtg_card_finder/tables/standard_fall.rb
mtg-card-finder-0.1.1 lib/mtg_card_finder/tables/standard_fall.rb
mtg-card-finder-0.1.0 lib/mtg_card_finder/tables/standard_fall.rb