Sha256: f27fc43957591a3021340e4b43204c9012f90b060c2672107a11589e5e1de35f

Contents?: true

Size: 353 Bytes

Versions: 3

Compression:

Stored size: 353 Bytes

Contents

class Hash
  def __evolve_to_timespan__
    serializer = Mongoid::Fields::Timespan
    object = self
    ::Timespan.new :from => serializer.from(object), :to => serializer.to(object), asap: serializer.asap(object)
  end

  def __evolve_to_duration_range__
    range = Range.new self['from'], self['to']
    ::DurationRange.new range, :seconds
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
timespan-0.5.1 lib/timespan/core_ext/hash.rb
timespan-0.5.0 lib/timespan/core_ext/hash.rb
timespan-0.4.9 lib/timespan/core_ext/hash.rb