Class Sequel::SQLTime
In: lib/sequel/sql.rb
Parent: ::Time

Time subclass that gets literalized with only the time value, so it operates like a standard SQL time type.

Methods

create   date   inspect   to_s  

Attributes

date  [W]  Set the date used for SQLTime instances.

Public Class methods

Create a new SQLTime instance given an hour, minute, second, and usec.

[Source]

    # File lib/sequel/sql.rb, line 36
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

use the date explicitly set, or the current date if there is not a date set.

[Source]

    # File lib/sequel/sql.rb, line 31
31:       def date
32:         @date || now
33:       end

Public Instance methods

Show that this is an SQLTime, and the time represented

[Source]

    # File lib/sequel/sql.rb, line 44
44:     def inspect
45:      "#<#{self.class} #{to_s}>"
46:     end

Return a string in HH:MM:SS format representing the time.

[Source]

    # File lib/sequel/sql.rb, line 49
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

[Validate]