Sha256: f1930a4a3bd28c2f731601f8fa4b4bca2c4807078c6d7bb37c2ed615f827c999

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

module TOML
  class Parser
    attr_reader :hash

    def initialize(content, options = {})
      @hash = {}
      @current = @hash

      parsed = Document.parse(content)
      parsed.matches.map(&:value).compact.each do |match|
        if match.is_a? Keygroup
          @current = match.navigate_keys(@hash, options[:symbolize_keys])
        elsif match.is_a? Keyvalue
          match.assign(@current, options[:symbolize_keys])
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
toml-rb-0.1.2 lib/toml/parser.rb
toml-rb-0.1.0 lib/toml/parser.rb
toml_parser-ruby-0.1.0 lib/toml/parser.rb