Sha256: ba4f6c51464a57ffd6f508b0eb039209a2458efdcd5d3f460a7adcd3bf32518a
Contents?: true
Size: 682 Bytes
Versions: 4
Compression:
Stored size: 682 Bytes
Contents
require_relative '../concerns/persistable' class StandardRise 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