Class: TimeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/emoji_clock/time_parser.rb

Class Method Summary collapse

Class Method Details

.parse(*args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/emoji_clock/time_parser.rb', line 2

def self.parse(*args)
  if args.size > 1
    Time.new(*args)
  else
    case args.first
    when Time
      args.first
    when String
      Time.new(args.first)
    when Integer
      Time.at(args.first)
    end
  end
end