Class: RDF::Literal::DateTime
- Inherits:
-
RDF::Literal
- Object
- RDF::Literal
- RDF::Literal::DateTime
- Defined in:
- lib/active_fedora.rb
Constant Summary collapse
- ALTERNATIVE_FORMAT =
'%Y-%m-%dT%H:%M:%S'.freeze
- DOT =
'.'.freeze
- Z =
'Z'.freeze
- EMPTY =
''.freeze
Instance Method Summary collapse
Instance Method Details
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/active_fedora.rb', line 25 def to_s @string ||= begin # Show nanoseconds but remove trailing zeros nano = @object.strftime('%N').sub(/0+\Z/, EMPTY) nano = DOT + nano unless nano.blank? @object.strftime(ALTERNATIVE_FORMAT) + nano + Z end end |