Class: Slither::Parser
- Inherits:
-
Object
- Object
- Slither::Parser
- Defined in:
- lib/slither/parser.rb
Instance Method Summary collapse
-
#initialize(definition, file) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(definition, file) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 8 9 |
# File 'lib/slither/parser.rb', line 4 def initialize(definition, file) @definition = definition @file = file # This may be used in the future for non-linear or repeating sections @mode = :linear end |
Instance Method Details
#parse ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/slither/parser.rb', line 11 def parse() @parsed = {} @content = read_file unless @content.empty? @definition.sections.each do |section| rows = fill_content(section) raise(Slither::RequiredSectionNotFoundError, "Required section '#{section.name}' was not found.") unless rows > 0 || section.optional end end @parsed end |