Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/isomorfeus/ferret/stdlib_patches.rb
Constant Summary collapse
- LEX_FORMAT =
{ :year => "%Y", :month => "%Y-%m", :day => "%Y-%m-%d", :hour => "%Y-%m-%d %H", :minute => "%Y-%m-%d %H:%M", :second => "%Y-%m-%d %H:%M:%S", :millisecond => "%Y-%m-%d %H:%M:%S" }
Instance Method Summary collapse
-
#to_s_lex(precision = :day) ⇒ Object
Convert the Time to a lexicographically sortable string with the required precision.
Instance Method Details
#to_s_lex(precision = :day) ⇒ Object
Convert the Time to a lexicographically sortable string with the required precision. The format used is %Y%m%d %H:%M:%S.
- precision
the precision required in the string version of the time. The options are :year, :month, :day, :hour, :minute and :second
- return
a lexicographically sortable string representing the date
94 95 96 |
# File 'lib/isomorfeus/ferret/stdlib_patches.rb', line 94 def to_s_lex(precision = :day) self.strftime(LEX_FORMAT[precision]) end |