Module: IniParse
- Defined in:
- lib/iniparse.rb,
lib/iniparse/lines.rb,
lib/iniparse/parser.rb,
lib/iniparse/document.rb,
lib/iniparse/generator.rb,
lib/iniparse/line_collection.rb
Defined Under Namespace
Modules: LineCollection, Lines Classes: Document, Generator, IniParseError, LineNotAllowed, NoSectionError, OptionCollection, ParseError, Parser, SectionCollection
Constant Summary collapse
- VERSION =
'1.5.0'.freeze
Class Method Summary collapse
-
.gen(&blk) ⇒ Object
Creates a new IniParse::Document using the specification you provide.
-
.open(path) ⇒ Object
Opens the file at
path
, reads and parses it’s contents. -
.parse(source) ⇒ Object
Parse given given INI document source
source
.
Class Method Details
.gen(&blk) ⇒ Object
Creates a new IniParse::Document using the specification you provide.
See IniParse::Generator.
Returns
IniParse::Document
63 64 65 |
# File 'lib/iniparse.rb', line 63 def gen(&blk) IniParse::Generator.new.gen(&blk) end |
.open(path) ⇒ Object
Opens the file at path
, reads and parses it’s contents.
Parameters
- path<String>
-
The path to the INI document.
Returns
IniParse::Document
50 51 52 53 54 |
# File 'lib/iniparse.rb', line 50 def open(path) document = parse(File.read(path)) document.path = path document end |
.parse(source) ⇒ Object
Parse given given INI document source source
.
See IniParse::Parser.parse
Parameters
- source<String>
-
The source from the INI document.
Returns
IniParse::Document
38 39 40 |
# File 'lib/iniparse.rb', line 38 def parse(source) IniParse::Parser.new(source.gsub(/(?<!\\)\\\n/, '')).parse end |