Class: RDF::Literal::Day

Inherits:
Date show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-d4b9d6c7dd20/lib/rdf/xsd/date.rb

Overview

gDay is a gregorian day that recurs, specifically a day of the month such as the 5th of the month. Arbitrary recurring days are not supported by this datatype. The value space of gDay is the space of a set of calendar dates as defined in ยง 3 of [ISO 8601]. Specifically, it is a set of one-day long, monthly periodic instances.

Constant Summary collapse

DATATYPE =
RDF::XSD.gDay
GRAMMAR =
%r(\A---(\d{2})((?:[\+\-]\d{2}:\d{2})|UTC|Z)?\Z).freeze
FORMAT =
'%d%Z'.freeze

Constants inherited from RDF::Literal

FALSE, TRUE, ZERO

Instance Attribute Summary

Attributes inherited from RDF::Literal

#datatype, #language

Instance Method Summary collapse

Methods inherited from Date

#==, #canonicalize!, #has_timezone?, #humanize, #to_s, #tz, #valid?

Methods inherited from RDF::Literal

#==, #canonicalize!, #compatible?, #comperable_datatype?, #eql?, #escape, #has_datatype?, #has_language?, #hash, #humanize, #inspect, #literal?, #method_missing, #object, #plain?, #respond_to_missing?, #simple?, #squish, #squish!, #to_s, #valid?, #valid_extended?, #validate!, #value, #value_hash

Methods included from Term

#<=>, #==, #aggregate?, #compatible?, #eql?, #escape, #evaluate, #ndvars, #term?, #to_base, #to_term, #vars

Methods included from SPARQL::Algebra::Expression

cast, #constant?, #evaluate, extension, extensions, for, #invalid?, new, #node?, open, #optimize, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?

Methods included from Value

#anonymous?, #canonicalize, #canonicalize!, #constant?, #graph?, #inspect, #inspect!, #invalid?, #iri?, #list?, #literal?, #node?, #resource?, #start_with?, #statement?, #term?, #to_nquads, #to_ntriples, #to_rdf, #to_term, #type_error, #uri?, #valid?, #validate!, #variable?

Constructor Details

#initialize(value, datatype: nil, lexical: nil, **options) ⇒ Day

Returns a new instance of Day



83
84
85
86
87
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-d4b9d6c7dd20/lib/rdf/xsd/date.rb', line 83

def initialize(value, datatype: nil, lexical: nil, **options)
  @string = lexical || value.to_s
  object = GRAMMAR.match(value.to_s) && ::Date.parse("0000-01-#{$1}#{$2}")
  super(object, lexical: @string)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RDF::Literal