Class: LocalizedString

Inherits:
String
  • Object
show all
Includes:
Literal
Defined in:
lib/active_rdf/objectmanager/literal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Literal

typed, #xsd_type

Constructor Details

#initialize(value, lang = nil) ⇒ LocalizedString

Returns a new instance of LocalizedString.



57
58
59
60
61
62
# File 'lib/active_rdf/objectmanager/literal.rb', line 57

def initialize value, lang=nil
  super(value)

  @lang = lang
  @lang = lang[1..-1] if @lang[0..0] == '@'
end

Instance Attribute Details

#langObject (readonly)

Returns the value of attribute lang.



56
57
58
# File 'lib/active_rdf/objectmanager/literal.rb', line 56

def lang
  @lang
end

Instance Method Details

#to_ntripleObject



64
65
66
67
68
69
70
# File 'lib/active_rdf/objectmanager/literal.rb', line 64

def to_ntriple
  if @lang
    "\"#{to_s}\"@#@lang"
  else
    super
  end
end