Class: RDF::Literal::MonthDay

Inherits:
Date
  • Object
show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/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

Instance Method Summary collapse

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-e532a0ab7189/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