Class: Db2Query::Type::Time
- Inherits:
-
Value
- Object
- Value
- Db2Query::Type::Time
show all
- Defined in:
- lib/db2_query/type/time.rb
Instance Attribute Summary
Attributes inherited from Value
#options
Instance Method Summary
collapse
Methods inherited from Value
#initialize, #quote, #type_name
Instance Method Details
#deserialize(value) ⇒ Object
25
26
27
|
# File 'lib/db2_query/type/time.rb', line 25
def deserialize(value)
value.strftime("%H:%M:%S")
end
|
#serialize(value) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/db2_query/type/time.rb', line 10
def serialize(value)
if value.is_a?(::String)
case value
when /\A(\d\d)[:,.](\d\d)[:,.](\d\d)\z/
quote(value)
else
nil
end
elsif value.is_a?(::Time)
quote(value.strftime("%T"))
else
nil
end
end
|
#type ⇒ Object
6
7
8
|
# File 'lib/db2_query/type/time.rb', line 6
def type
:time
end
|