Class: RDF::Literal::MonthDay

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

Overview

gMonthDay is a gregorian date that recurs, specifically a day of the year such as the third of May. Arbitrary recurring dates are not supported by this datatype. The value space of gMonthDay is the set of calendar dates, as defined in ยง 3 of [ISO 8601]. Specifically, it is a set of one-day long, annually periodic instances.

Constant Summary collapse

DATATYPE =
RDF::XSD.gMonthDay
GRAMMAR =
%r(\A--(\d{2}-\d{2})((?:[\+\-]\d{2}:\d{2})|UTC|Z)?\Z).freeze
FORMAT =
'%m-%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) ⇒ MonthDay

Returns a new instance of MonthDay



65
66
67
68
69
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-d4b9d6c7dd20/lib/rdf/xsd/date.rb', line 65

def initialize(value, datatype: nil, lexical: nil, **options)
  @string = lexical || value.to_s
  object = GRAMMAR.match(value.to_s) && ::Date.parse("0000-#{$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