Class: KDL::Types::IRLReference

Inherits:
Value
  • Object
show all
Defined in:
lib/kdl/types/irl.rb,
lib/kdl/types/irl/parser.rb

Direct Known Subclasses

IRL

Defined Under Namespace

Classes: Parser

Constant Summary

Constants inherited from Value

Value::Null

Instance Attribute Summary collapse

Attributes inherited from Value

#format, #type, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Value

#as_type, from, #stringify_value, #to_s

Constructor Details

#initialize(value, unicode_value:, unicode_domain:, unicode_path:, unicode_search:, unicode_hash:, **kwargs) ⇒ IRLReference

Returns a new instance of IRLReference.



12
13
14
15
16
17
18
19
# File 'lib/kdl/types/irl.rb', line 12

def initialize(value, unicode_value:, unicode_domain:, unicode_path:, unicode_search:, unicode_hash:, **kwargs)
  super(value, **kwargs)
  @unicode_value = unicode_value
  @unicode_domain = unicode_domain
  @unicode_path = unicode_path
  @unicode_search = unicode_search
  @unicode_hash = unicode_hash
end

Instance Attribute Details

#unicode_domainObject (readonly)

Returns the value of attribute unicode_domain.



6
7
8
# File 'lib/kdl/types/irl.rb', line 6

def unicode_domain
  @unicode_domain
end

#unicode_hashObject (readonly)

Returns the value of attribute unicode_hash.



6
7
8
# File 'lib/kdl/types/irl.rb', line 6

def unicode_hash
  @unicode_hash
end

#unicode_pathObject (readonly)

Returns the value of attribute unicode_path.



6
7
8
# File 'lib/kdl/types/irl.rb', line 6

def unicode_path
  @unicode_path
end

#unicode_searchObject (readonly)

Returns the value of attribute unicode_search.



6
7
8
# File 'lib/kdl/types/irl.rb', line 6

def unicode_search
  @unicode_search
end

#unicode_valueObject (readonly)

Returns the value of attribute unicode_value.



6
7
8
# File 'lib/kdl/types/irl.rb', line 6

def unicode_value
  @unicode_value
end

Class Method Details

.call(value, type = 'irl-reference') ⇒ Object



21
22
23
24
25
26
27
# File 'lib/kdl/types/irl.rb', line 21

def self.call(value, type = 'irl-reference')
  return nil unless value.is_a? ::KDL::Value::String

  ascii_value, params = parser(value.value).parse

  new(URI.parse(ascii_value), type: type, **params)
end

.parser(string) ⇒ Object



29
30
31
# File 'lib/kdl/types/irl.rb', line 29

def self.parser(string)
  IRLReference::Parser.new(string)
end