Class: Clive::Type::Time

Inherits:
Object show all
Defined in:
lib/clive/type/definitions.rb

Overview

Time accepts any value which can be parsed by Time.parse, it returns the correct Time object.

Instance Method Summary collapse

Methods inherited from Clive::Type

cast, find_class, match, refute, typecast, valid?

Instance Method Details

#typecast(arg) ⇒ Object



145
146
147
# File 'lib/clive/type/definitions.rb', line 145

def typecast(arg)
  ::Time.parse arg
end

#valid?(arg) ⇒ Boolean

Returns:



138
139
140
141
142
143
# File 'lib/clive/type/definitions.rb', line 138

def valid?(arg)
  ::Time.parse arg
  true
rescue
  false
end