class Time
Time
class extensions.
Public Class Methods
terse(format = self.terse_format)
click to toggle source
Shorthand for Time.now.terse
Example:
Time.terse => "20201231125959000000000"
Return: [String] Time.now time terse string
# File lib/sixarm_ruby_time_terse/time.rb, line 34 def self.terse(format = self.terse_format) now.terse(format) end
terse_format()
click to toggle source
Get class-scope terse format string
Example:
Time.terse_format => "%Y%m%d%H%M%S%N"
Return: [String] terse format string
# File lib/sixarm_ruby_time_terse/time.rb, line 68 def self.terse_format @@terse_format ||= '%Y%m%d%H%M%S%N' end
terse_format=(format)
click to toggle source
Set class-scope terse format string
Example:
Time.terse_format = "%Y%m%d%H%M%S%N"
Return: [String] terse format string
# File lib/sixarm_ruby_time_terse/time.rb, line 80 def self.terse_format=(format) @@terse_format = format end
terse_format_default()
click to toggle source
Get class-scope terse format default string
Example:
Time.terse_format_default => "%Y%m%d%H%M%S%N"
Return: [String] terse format default string
# File lib/sixarm_ruby_time_terse/time.rb, line 92 def self.terse_format_default "%Y%m%d%H%M%S%N" end
Public Instance Methods
terse(format = terse_format)
click to toggle source
Create a time terse string using the default format “YYYYMMDDTHHMMSSNNNNNNNNN”
This standard format is specified in IETF RFC 3339 and ISO 8601.
@see www.ietf.org/rfc/rfc3339.txt
Example:
time = Time.now time.terse => "20201231125959000000000"
Return: [String] a time terse string
# File lib/sixarm_ruby_time_terse/time.rb, line 21 def terse(format = terse_format) getutc.strftime(format) end
terse_format()
click to toggle source
Get terse format string
Example:
time.terse_format => "%Y%m%d%H%M%S%N"
Return: [String] terse format string
# File lib/sixarm_ruby_time_terse/time.rb, line 46 def terse_format @terse_format ||= '%Y%m%d%H%M%S%N' end
terse_format=(format)
click to toggle source
Set terse format string
Example:
time.terse_format = "%Y%m%d%H%M%S%N"
# File lib/sixarm_ruby_time_terse/time.rb, line 56 def terse_format=(format) @terse_format = format end