Module: Mongoid::Timespanned

Extended by:
ActiveSupport::Concern
Defined in:
lib/timespan/mongoid/timespanned.rb

Defined Under Namespace

Modules: ClassMethods

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.log(msg) ⇒ Object

Returns the value of attribute log.



12
13
14
# File 'lib/timespan/mongoid/timespanned.rb', line 12

def log
  @log
end

Class Method Details

.log!Object



22
23
24
# File 'lib/timespan/mongoid/timespanned.rb', line 22

def log!
  @log = true
end

.log?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/timespan/mongoid/timespanned.rb', line 18

def log?
  @log
end

Instance Method Details

#asap_for(tspan_field = :period) ⇒ Object



5
6
7
8
9
# File 'lib/timespan/mongoid/timespanned.rb', line 5

def asap_for tspan_field = :period
  ts = ::Timespan.asap duration: send(tspan_field).duration
  self.send("#{tspan_field}=", ts)
  self.save!
end