Class: JsDuck::Parser
- Inherits:
-
Object
- Object
- JsDuck::Parser
- Defined in:
- lib/jsduck/parser.rb
Overview
Performs the actual parsing of CSS or JS source.
This is the class that brings together all the different steps of parsing the source.
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
-
#parse(contents, filename = "", options = {}) ⇒ Object
Parses file into final docset that can be fed into Aggregator.
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
18 19 20 21 22 23 24 |
# File 'lib/jsduck/parser.rb', line 18 def initialize @doc_parser = Doc::Parser.new = ClassDocExpander.new @doc_processor = Doc::Processor.new @merger = Merger.new @filename = "" end |
Instance Method Details
#parse(contents, filename = "", options = {}) ⇒ Object
Parses file into final docset that can be fed into Aggregator
27 28 29 30 31 32 33 34 35 |
# File 'lib/jsduck/parser.rb', line 27 def parse(contents, filename="", ={}) @doc_processor.filename = @filename = filename parse_js_or_css(contents, filename, ).map do |docset| (docset) end.flatten.map do |docset| merge(docset) end end |