Sha256: 77cff3b7acbfb5e2e2f9be1a7e98d688ea18ce060cf653f2019d91711d20c252

Contents?: true

Size: 985 Bytes

Versions: 22

Compression:

Stored size: 985 Bytes

Contents

class Numeric

  def milliseconds
    self / 1000.0
  end
  alias millisecond milliseconds
  alias millisecs milliseconds
  alias millisec milliseconds

  def in_milliseconds
    self * 1000
  end

  def seconds
    self
  end
  alias second seconds
  alias sec seconds
  alias secs seconds

  def in_seconds
    self
  end

  def minutes
    self * 60
  end
  alias minute minutes
  alias min minutes
  alias mins minutes

  def in_minutes
    self / 1.minute.to_f
  end

  def hours
    self * 3600
  end
  alias hour hours

  def in_hours
    self / 1.hour.to_f
  end

  def days
    self.hours * 24
  end
  alias day days

  def in_days
    self / 1.day.to_f
  end

  def weeks
    self.days * 7
  end
  alias week weeks

  def in_weeks
    self / 1.week.to_f
  end

  def months
    self.days * 30
  end
  alias month months

  def in_months
    self / 1.month.to_f
  end

  def years
    self.days * 365
  end
  alias year years

  def in_years
    self / 1.year.to_f
  end

end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
cha_work-0.1 lib/cha_work/sugar/time.rb
sugarcube-2.8.2 lib/all/sugarcube-numbers/time.rb
sugarcube-2.8.1 lib/all/sugarcube-numbers/time.rb
sugarcube-2.8.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.7.1 lib/all/sugarcube-numbers/time.rb
sugarcube-2.7.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.6.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.5.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.4.2 lib/all/sugarcube-numbers/time.rb
sugarcube-2.4.1 lib/all/sugarcube-numbers/time.rb
sugarcube-2.4.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.3.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.2.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.5 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.4 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.3 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.2 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.1 lib/all/sugarcube-numbers/time.rb
sugarcube-2.1.0 lib/all/sugarcube-numbers/time.rb
sugarcube-2.0.2 lib/all/sugarcube-numbers/time.rb