Class: Riddle::Configuration::Parser::InnerParser
- Inherits:
-
Object
- Object
- Riddle::Configuration::Parser::InnerParser
- Defined in:
- lib/riddle/configuration/parser.rb
Constant Summary collapse
- SETTING_PATTERN =
/^(\w+)\s*=\s*(.*)$/
- EndOfFileError =
Class.new StandardError
Instance Method Summary collapse
-
#initialize(input) ⇒ InnerParser
constructor
A new instance of InnerParser.
- #parse! ⇒ Object
Constructor Details
#initialize(input) ⇒ InnerParser
Returns a new instance of InnerParser.
138 139 140 141 |
# File 'lib/riddle/configuration/parser.rb', line 138 def initialize(input) @stream = StringIO.new(input.gsub("\\\n", '')) @sections = {} end |
Instance Method Details
#parse! ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/riddle/configuration/parser.rb', line 143 def parse! while label = next_line do @sections[label] = next_settings end @sections rescue EndOfFileError @sections end |