Class: RDF::N3::Algebra::Time::LocalTime
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Time::LocalTime
- Defined in:
- lib/rdf/n3/algebra/time/local_time.rb
Overview
For a date-time format string, its time:localTime is the result of formatting the current time of processing and local timezone in the format given. If the format string has zero length, then the ISOdate standrad format is used. [ is time:localTime of āā] the therefore the current date time. It will end with a numeric timezone code or āZā for UTC (GMT).
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#resolve(resource, position:) ⇒ RDF::Term
The time:localTime operator takes string or dateTime and returns current time formatted according to the subject.
Methods inherited from ResourceOperator
#as_literal, #execute, #input_operand, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #input_operand, #rank, #to_uri
Instance Method Details
#resolve(resource, position:) ⇒ RDF::Term
The time:localTime operator takes string or dateTime and returns current time formatted according to the subject.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rdf/n3/algebra/time/local_time.rb', line 17 def resolve(resource, position:) case position when :subject return nil unless resource.literal? resource = "%FT%T%:z" if resource.to_s.empty? RDF::Literal(DateTime.now.strftime(resource.to_s)) when :object return nil unless resource.literal? || resource.variable? resource end end |