Class: Glossarist::ResolutionAdapter::Bibliography

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_id, concepts) ⇒ Bibliography

Returns a new instance of Bibliography.



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

def initialize(source_id, concepts)
  super()
  @source_id = source_id
  @concepts = concepts
end

Instance Attribute Details

#conceptsObject (readonly)

Returns the value of attribute concepts.



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

def concepts
  @concepts
end

#source_idObject (readonly)

Returns the value of attribute source_id.



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

def source_id
  @source_id
end

Instance Method Details

#resolve(reference) ⇒ Object



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

def resolve(reference)
  return nil unless reference.is_a?(ConceptReference)
  return nil unless reference.source == @source_id

  concepts.by_id_and(reference.concept_id, reference.version)
end