Class: Glossarist::ResolutionAdapter::Package

Inherits:
Glossarist::ResolutionAdapter show all
Defined in:
lib/glossarist/resolution_adapter/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concepts, uri_prefix:) ⇒ Package

Returns a new instance of Package.



8
9
10
11
12
# File 'lib/glossarist/resolution_adapter/package.rb', line 8

def initialize(concepts, uri_prefix:)
  super()
  @uri_prefix = uri_prefix
  @local_adapter = Local.new(concepts)
end

Instance Attribute Details

#local_adapterObject (readonly)

Returns the value of attribute local_adapter.



6
7
8
# File 'lib/glossarist/resolution_adapter/package.rb', line 6

def local_adapter
  @local_adapter
end

#uri_prefixObject (readonly)

Returns the value of attribute uri_prefix.



6
7
8
# File 'lib/glossarist/resolution_adapter/package.rb', line 6

def uri_prefix
  @uri_prefix
end

Instance Method Details

#resolve(reference) ⇒ Object



14
15
16
17
18
19
# File 'lib/glossarist/resolution_adapter/package.rb', line 14

def resolve(reference)
  return nil unless reference.ref_type == "urn"
  return nil unless reference.source == uri_prefix

  @local_adapter.resolve_by_id(reference.concept_id)
end