class Sequel::SQLTime
Time subclass that gets literalized with only the time value, so it operates like a standard SQL
time type.
Attributes
date[W]
Set the date used for SQLTime
instances.
Public Class Methods
create(hour, minute, second, usec = 0)
click to toggle source
Create a new SQLTime
instance given an hour, minute, second, and usec.
# File lib/sequel/sql.rb 36 def create(hour, minute, second, usec = 0) 37 t = date 38 meth = Sequel.application_timezone == :utc ? :utc : :local 39 public_send(meth, t.year, t.month, t.day, hour, minute, second, usec) 40 end
date()
click to toggle source
use the date explicitly set, or the current date if there is not a date set.
# File lib/sequel/sql.rb 31 def date 32 @date || now 33 end
Public Instance Methods
inspect()
click to toggle source
Show that this is an SQLTime
, and the time represented
# File lib/sequel/sql.rb 44 def inspect 45 "#<#{self.class} #{to_s}>" 46 end
to_s(*args)
click to toggle source
Return a string in HH:MM:SS format representing the time.
Calls superclass method
# File lib/sequel/sql.rb 49 def to_s(*args) 50 if args.empty? 51 strftime('%H:%M:%S') 52 else 53 # Superclass may have defined a method that takes a format string, 54 # and we shouldn't override in that case. 55 super 56 end 57 end