Class: Yarrow::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/yarrow/generator.rb

Overview

Generates documentation from a model.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Generator

Returns a new instance of Generator.



38
39
40
41
# File 'lib/yarrow/generator.rb', line 38

def initialize(config)
  @config = config
  @workflow = Process::Workflow.new(config)
end

Instance Attribute Details

#configObject (readonly)

private



63
64
65
# File 'lib/yarrow/generator.rb', line 63

def config
  @config
end

#workflowObject (readonly)

private



63
64
65
# File 'lib/yarrow/generator.rb', line 63

def workflow
  @workflow
end

Instance Method Details

#generateObject



53
54
55
56
57
58
59
# File 'lib/yarrow/generator.rb', line 53

def generate
  process do |manifest|
    generators.each do |generator|
      generator.generate(manifest)
    end
  end
end

#generatorsObject



65
66
67
# File 'lib/yarrow/generator.rb', line 65

def generators
  [Web::Generator.new(config)]
end

#process(&block) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/yarrow/generator.rb', line 43

def process(&block)
  workflow.connect(ScanSource.new)
  workflow.connect(ExpandCollections.new)
  workflow.connect(FlattenManifest.new)

  workflow.process do |result|
    block.call(result)
  end
end