Method: TimeMath::Sequence#floor!

Defined in:
lib/time_math/sequence.rb

#floor!(unit, span = 1) ⇒ self

Adds Units::Base#floor to list of operations to apply to sequence items.

Parameters:

  • unit (Symbol)
  • span (Numeric) (defaults to: 1)

    how many units to floor to.

Returns:

  • (self)


178
179
180
181
182
183
184
185
186
187
# File 'lib/time_math/sequence.rb', line 178

Op::OPERATIONS.each do |operation|
  define_method "#{operation}!" do |*arg|
    @op.send("#{operation}!", *arg)
    self
  end

  define_method operation do |*arg|
    dup.send("#{operation}!", *arg)
  end
end