Sha256: 36c6c249a3574871c8bedcf00a847291c53e5b677be340854770bba29aa3158e

Contents?: true

Size: 320 Bytes

Versions: 2

Compression:

Stored size: 320 Bytes

Contents

class Account
  include Mongoid::Document

  field :period, :type => ::Timespan, :between => true

  def self.create_it! duration
    t = ::Timespan.new(duration: duration)
    self.new period: t
  end

  def self.between from, to
    Account.where(:'period.from'.gt => from.to_i, :'period.to'.lte => to.to_i)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timespan-0.4.1 spec/timespan/mongoid/models/account_3x.rb
timespan-0.4.0 spec/timespan/mongoid/models/account_3x.rb