Class: LocalizedString
- Includes:
- RDFS::Literal
- Defined in:
- lib/active_rdf/objectmanager/literal.rb
Instance Attribute Summary collapse
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(value, lang) ⇒ LocalizedString
constructor
A new instance of LocalizedString.
- #inspect ⇒ Object
-
#to_literal_s ⇒ Object
returns quoted string with language type if present.
Methods included from RDFS::Literal
Constructor Details
#initialize(value, lang) ⇒ LocalizedString
Returns a new instance of LocalizedString.
79 80 81 82 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 79 def initialize(value, lang) super(value) @lang = lang.sub(/^@/,'') end |
Instance Attribute Details
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
78 79 80 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 78 def lang @lang end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
84 85 86 87 88 89 90 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 84 def ==(other) if other.is_a?(LocalizedString) super && @lang == other.lang else super end end |
#inspect ⇒ Object
93 94 95 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 93 def inspect super + "@#@lang" end |
#to_literal_s ⇒ Object
returns quoted string with language type if present. xsd:string isn’t appended when lang missing (xsd:string should be considered the default type)
99 100 101 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 99 def to_literal_s $activerdf_without_datatype ? "\"#{self}\"" : "\"#{self}\"@#@lang" end |