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, and second.

# 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
date() click to toggle source
# File lib/sequel/sql.rb, line 54
def date
  @date || now
end

Public Instance Methods

inspect() click to toggle source

Show that this is an SQLTime, and the time represented

# File lib/sequel/sql.rb, line 66
def inspect
 "#<#{self.class} #{to_s}>"
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, line 71
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