Class: RDF::Literal

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/date.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/double.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/integer.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/xml.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/any_uri.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/duration.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-xsd-e532a0ab7189/lib/rdf/xsd/binary.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-d4556f730a9b/lib/json/ld/extensions.rb

Overview

override several inspect functions to improve output for what we're doing

Defined Under Namespace

Classes: AnyURI, Base64Binary, Byte, DateTimeStamp, Day, DayTimeDuration, Duration, Float, HTML, HexBinary, Int, Long, Month, MonthDay, NegativeInteger, NonNegativeInteger, NonPositiveInteger, PositiveInteger, Short, UnsignedByte, UnsignedInt, UnsignedLong, UnsignedShort, XML, Year, YearMonth, YearMonthDuration

Instance Method Summary collapse

Instance Method Details

#inspectObject



5
6
7
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb', line 5

def inspect
  "\"#{escape(value)}\" R:L:(#{self.class.to_s.match(/([^:]*)$/)})"
end

#valid_extended?Boolean

Validate extended RDF

Returns:

  • (Boolean)


37
38
39
40
41
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-d4556f730a9b/lib/json/ld/extensions.rb', line 37

def valid_extended?
  return false if language? && language.to_s !~ /^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/
  return false if datatype? && datatype.invalid?
  value.is_a?(String)
end