Class: Glossarist::ConceptCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/glossarist/concept_collector.rb

Class Method Summary collapse

Class Method Details

.collect(dir) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/glossarist/concept_collector.rb', line 5

def self.collect(dir)
  dir = File.expand_path(dir)
  unless File.directory?(dir)
    raise ArgumentError, "#{dir} is not a directory"
  end

  if v2_concepts?(dir)
    collect_v2_concepts(dir)
  elsif managed_concepts?(dir)
    collect_managed_concepts(dir)
  elsif v1_concepts?(dir)
    collect_v1_concepts(dir)
  else
    []
  end
end

.each_concept(dir, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/glossarist/concept_collector.rb', line 22

def self.each_concept(dir, &block)
  dir = File.expand_path(dir)
  unless File.directory?(dir)
    raise ArgumentError, "#{dir} is not a directory"
  end
  return enum_for(:each_concept, dir) unless block

  if v2_concepts?(dir)
    each_v2_concept(dir, &block)
  elsif managed_concepts?(dir)
    each_managed_concept(dir, &block)
  elsif v1_concepts?(dir)
    each_v1_concept(dir, &block)
  end
end