Module: DbStore::DatasetConfig
- Defined in:
- lib/wherever/db_store/dataset.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/wherever/db_store/dataset.rb', line 9 def self.included(base) base.send :include, Mongoid::Document base.send :include, DbStore::RecordMatcher base.field :values, :type => Hash, :default => Hash.new(0) end |
Instance Method Details
#diff(record) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/wherever/db_store/dataset.rb', line 20 def diff(record) res = {} record.keys.each do |key| res[key] = record[key] - self.values[key] end res end |
#sorter ⇒ Object
16 17 18 |
# File 'lib/wherever/db_store/dataset.rb', line 16 def sorter self.trade_id * 100 + self.version end |