Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/ruson/class/time.rb

Class Method Summary collapse

Class Method Details

.new(value) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/ruson/class/time.rb', line 2

def self.new(value)
  case value
  when Integer, Float
    Time.at(value).to_time
  when String
    Time.parse(value).to_time
  else
    value
  end
end