Class: Lutaml::Rdf::Iri

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/lutaml/rdf/iri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri_string) ⇒ Iri

Returns a new instance of Iri.



10
11
12
# File 'lib/lutaml/rdf/iri.rb', line 10

def initialize(uri_string)
  @value = uri_string.to_s.freeze
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/lutaml/rdf/iri.rb', line 8

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



22
23
24
# File 'lib/lutaml/rdf/iri.rb', line 22

def <=>(other)
  other.is_a?(self.class) ? value <=> other.value : nil
end

#==(other) ⇒ Object Also known as: eql?



26
27
28
# File 'lib/lutaml/rdf/iri.rb', line 26

def ==(other)
  other.is_a?(self.class) && value == other.value
end

#compact(namespace_set) ⇒ Object



18
19
20
# File 'lib/lutaml/rdf/iri.rb', line 18

def compact(namespace_set)
  namespace_set.compact(value)
end

#expand(namespace_set) ⇒ Object



14
15
16
# File 'lib/lutaml/rdf/iri.rb', line 14

def expand(namespace_set)
  namespace_set.resolve_compact_iri(value)
end

#hashObject



31
32
33
# File 'lib/lutaml/rdf/iri.rb', line 31

def hash
  value.hash
end

#inspectObject



39
40
41
# File 'lib/lutaml/rdf/iri.rb', line 39

def inspect
  "#<#{self.class.name} #{value}>"
end

#to_sObject



35
36
37
# File 'lib/lutaml/rdf/iri.rb', line 35

def to_s
  value
end