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.



51
52
53
54
55
56
# File 'lib/active_rdf/objectmanager/literal.rb', line 51

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.



50
51
52
# File 'lib/active_rdf/objectmanager/literal.rb', line 50

def lang
  @lang
end

Instance Method Details

#to_ntripleObject



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

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