Class: Liquid::Drops::ConceptsDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/liquid/drops/concepts_drop.rb

Constant Summary collapse

NON_LANGUAGE_FIELDS =

rubocop:disable Lint/MissingSuper

%w[term termid groups].freeze

Instance Method Summary collapse

Constructor Details

#initialize(managed_concept_collection, filters = {}) ⇒ ConceptsDrop

Returns a new instance of ConceptsDrop.



9
10
11
12
13
14
15
16
# File 'lib/liquid/drops/concepts_drop.rb', line 9

def initialize(managed_concept_collection, filters = {})
  @concepts_collection = managed_concept_collection
  @concepts_map = {}

  filtered_concepts(@concepts_collection, filters).each do |concept|
    @concepts_map[concept["term"]] = concept
  end
end

Instance Method Details

#[](concept_name) ⇒ Object



23
24
25
# File 'lib/liquid/drops/concepts_drop.rb', line 23

def [](concept_name)
  @concepts_map[concept_name]
end

#conceptsObject

rubocop:enable Lint/MissingSuper



19
20
21
# File 'lib/liquid/drops/concepts_drop.rb', line 19

def concepts
  @concepts_map
end

#each(&block) ⇒ Object



27
28
29
# File 'lib/liquid/drops/concepts_drop.rb', line 27

def each(&block)
  @concepts_map.values.each(&block)
end