Module: Processor
- Defined in:
- lib/processor.rb
Combined Stages collapse
Stage #1 - FileProcessor collapse
-
.parse_files(files = nil) ⇒ Object
Parsing Files and creating comment stream.
Stage #2 - CommentProcessor collapse
-
.process_comments(comments) ⇒ Object
Processing comment-stream and convert to CodeObjects This stage also adds the CodeObjects to Dom.
Stage #3 - TemplateProcessor collapse
Stage #4 - Document Processor collapse
Class Method Details
.parse_files(files = nil) ⇒ Object
Parsing Files and creating comment stream
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/processor.rb', line 22 def self.parse_files(files = nil) files ||= Configs.files return if files.nil? files = [files] unless files.is_a? Array comments = [] files.each do |file| Logger.info "Processing file #{file}" comments += Parser::Parser.parse_file(file) end return comments end |
.perform_all_tasks ⇒ Object
56 57 58 |
# File 'lib/processor.rb', line 56 def self.perform_all_tasks Generator::Generator.all.each { |task| task.new.perform } end |
.prepare_documents ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/processor.rb', line 62 def self.prepare_documents # underscores will be replaced with whitespaces as title Configs.docs.each do |doc| doc_path = File.(doc, Configs.wdir) Logger.debug "Working with Document #{doc_path}" contents = File.read(doc_path) # Those documents get registered in a special {Dom::Node} Dom.docs document = Document::Document.new(doc_path, contents) Dom.docs.add_node(document.path, document) # The docs can be accessed via Dom later on end end |
.process_and_render ⇒ Object
10 11 12 13 |
# File 'lib/processor.rb', line 10 def self.process_and_render process_files_to_dom perform_all_tasks end |
.process_comments(comments) ⇒ Object
Processing comment-stream and convert to CodeObjects This stage also adds the CodeObjects to Dom.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/processor.rb', line 42 def self.process_comments(comments) comments = [comments] unless comments.is_a? Array comments.each do |comment| code_object = comment.to_code_object # convert to code_object Logger.debug "Adding to Dom: #{code_object}" Dom.add_node(code_object.path, code_object) # add to dom end end |
.process_files_to_dom(files = nil) ⇒ Object
15 16 17 |
# File 'lib/processor.rb', line 15 def self.process_files_to_dom(files = nil) process_comments parse_files(files) end |