class Time

Please see README

Public Class Methods

stamp(format = self.stamp_format) click to toggle source

Shorthand for Time.now.stamp

Example:

Time.stamp
=> "2020-12-31T12:59:59Z"

Return: [String] Time.now time stamp string

# File lib/sixarm_ruby_time_stamp/time.rb, line 34
def self.stamp(format = self.stamp_format)
  now.stamp(format)
end
stamp_format() click to toggle source

Get class-scope stamp format string

Example:

Time.stamp_format => "%Y-%m-%dT%H:%M:%S.%NZ"

Return: [String] stamp format string

# File lib/sixarm_ruby_time_stamp/time.rb, line 68
def self.stamp_format
  @@stamp_format ||= '%Y-%m-%dT%H:%M:%S.%NZ'
end
stamp_format=(format) click to toggle source

Set class-scope stamp format string

Example:

Time.stamp_format = "%Y-%m-%dT%H:%M:%S.%NZ"

Return: [String] stamp format string

# File lib/sixarm_ruby_time_stamp/time.rb, line 80
def self.stamp_format=(format)
  @@stamp_format = format
end
stamp_format_default() click to toggle source

Get class-scope stamp format default string

Example:

Time.stamp_format_default => "%Y-%m-%dT%H:%M:%S.%NZ"

Return: [String] stamp format default string

# File lib/sixarm_ruby_time_stamp/time.rb, line 92
def self.stamp_format_default
  "%Y-%m-%dT%H:%M:%S.%NZ"
end

Public Instance Methods

stamp(format = stamp_format) click to toggle source

Create a time stamp string using the default format “YYYY-MM-DDTHH:MM:SSZ”

This standard format is specified in IETF RFC 3339 and ISO 8601.

@see www.ietf.org/rfc/rfc3339.txt

Example:

time = Time.now
time.stamp
=> "2020-12-31T12:59:59Z"

Return: [String] a time stamp string

# File lib/sixarm_ruby_time_stamp/time.rb, line 21
def stamp(format = stamp_format)
  getutc.strftime(format)
end
stamp_format() click to toggle source

Get stamp format string

Example:

time.stamp_format => "%Y-%m-%dT%H:%M:%S.%NZ"

Return: [String] stamp format string

# File lib/sixarm_ruby_time_stamp/time.rb, line 46
def stamp_format
  @stamp_format ||= '%Y-%m-%dT%H:%M:%S.%NZ'
end
stamp_format=(format) click to toggle source

Set stamp format string

Example:

time.stamp_format = "%Y-%m-%dT%H:%M:%S.%NZ"
# File lib/sixarm_ruby_time_stamp/time.rb, line 56
def stamp_format=(format)
  @stamp_format = format
end