Class: Sequel::SQLTime
Overview
Time subclass that gets literalized with only the time value, so it operates like a standard SQL time type.
Class Attribute Summary collapse
Class Method Summary collapse
-
.create(hour, minute, second, usec = 0) ⇒ Object
Create a new SQLTime instance given an hour, minute, and second.
Instance Method Summary collapse
-
#to_s(*args) ⇒ Object
Return a string in HH:MM:SS format representing the time.
Class Attribute Details
.date ⇒ Object
54 55 56 |
# File 'lib/sequel/sql.rb', line 54 def date @date || now end |
Class Method Details
.create(hour, minute, second, usec = 0) ⇒ Object
Create a new SQLTime instance given an hour, minute, and second.
59 60 61 62 |
# File 'lib/sequel/sql.rb', line 59 def create(hour, minute, second, usec = 0) t = date local(t.year, t.month, t.day, hour, minute, second, usec) end |
Instance Method Details
#to_s(*args) ⇒ Object
Return a string in HH:MM:SS format representing the time.
66 67 68 69 70 71 72 73 74 |
# File 'lib/sequel/sql.rb', line 66 def to_s(*args) if args.empty? strftime('%H:%M:%S') else # Superclass may have defined a method that takes a format string, # and we shouldn't override in that case. super end end |