Sha256: 117ddd3cf8b263c278ea1c94367efce390dbf68649b1d710a38afd9601f7a4a6

Contents?: true

Size: 360 Bytes

Versions: 1

Compression:

Stored size: 360 Bytes

Contents

class Integer
  TimeLord::Units.constants.each do |constant|
    define_method constant.downcase do
      self * TimeLord::Units.const_get(constant)
    end
    alias_method "#{constant.downcase}s", constant.downcase
  end

  def ago
    TimeLord::Time.new(Time.now - self).period
  end

  def from_now
    TimeLord::Time.new(Time.now + self).period
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time-lord-1.0.1 lib/time-lord/extensions/integer.rb