Class: Wudoc

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Wudoc

Returns a new instance of Wudoc.



4
5
6
7
8
9
10
11
12
13
# File 'lib/wudoc.rb', line 4

def initialize path
  @path            = path
  @base            = FileUtils.pwd
  @queue           = []
  @traverser_count = 0

  @config = Configuration.new(@base)

  @writer = Generators::FileTree::Writer.new(@config, @base)
end

Class Method Details

.documentersObject



45
46
47
# File 'lib/wudoc.rb', line 45

def self.documenters
  @documenters ||= Hash.new
end

Instance Method Details

#documenter_for(file_name) ⇒ Object



41
42
43
# File 'lib/wudoc.rb', line 41

def documenter_for file_name
  self.class.documenters[file_name.split('.').last]
end

#goObject



15
16
17
18
19
20
21
22
# File 'lib/wudoc.rb', line 15

def go
  @writer.start

  throw_traverser_on_queue Traverser.new(@config, self)
  process_queue

  @writer.finish
end

#process_queueObject



24
25
26
27
28
29
30
31
# File 'lib/wudoc.rb', line 24

def process_queue
  until @queue.empty?
    traverser = @queue.shift
    @traverser_count += 1
    traverser.scan
  end
  puts "Traverser Count = #{ @traverser_count }"
end

#save(path, content, tags) ⇒ Object



37
38
39
# File 'lib/wudoc.rb', line 37

def save path, content, tags
  @writer.save path, content, tags
end

#throw_traverser_on_queue(traverser) ⇒ Object



33
34
35
# File 'lib/wudoc.rb', line 33

def throw_traverser_on_queue traverser
  @queue << traverser
end