Class: RDF::Literal::Month

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

Overview

gMonth is a gregorian month that recurs every year. The value space of gMonth is the space of a set of calendar months as defined in ยง 3 of [ISO 8601]. Specifically, it is a set of one-month long, yearly periodic instances.

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Month



100
101
102
103
104
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/date.rb', line 100

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