Class: Ourtime
- Inherits:
-
Object
- Object
- Ourtime
- Defined in:
- lib/ndr_support/ourtime.rb
Overview
Convert a string into a time value (timestamp) (helped by String.thetime)
Instance Attribute Summary collapse
-
#thetime ⇒ Object
readonly
Returns the value of attribute thetime.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(x = nil) ⇒ Ourtime
constructor
TODO: deprecate this…
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#thetime ⇒ Object (readonly)
Returns the value of attribute thetime.
7 8 9 |
# File 'lib/ndr_support/ourtime.rb', line 7 def thetime @thetime end |
Class Method Details
.zone ⇒ Object
9 10 11 |
# File 'lib/ndr_support/ourtime.rb', line 9 def self.zone @zone ||= ActiveSupport::TimeZone.new('London') end |
Instance Method Details
#empty? ⇒ Boolean
30 31 32 33 |
# File 'lib/ndr_support/ourtime.rb', line 30 def empty? # An unspecified time will be empty. A valid time will not. @thetime.nil? end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/ndr_support/ourtime.rb', line 26 def to_s @thetime ? @thetime.to_time.to_formatted_s(:ui) : '' end |