method

parse_config_lines

Importance_0
v1_9_3_125 - Show latest stable - 0 notes - Class: Config
parse_config_lines(io) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/openssl/lib/openssl/config.rb, line 54
      def parse_config_lines(io)
        section = 'default'
        data = {section => {}}
        while definition = get_definition(io)
          definition = clear_comments(definition)
          next if definition.empty?
          if definition[0] == [[
            if /\[([^\]]*)\]/ =~ definition
              section = $1.strip
              data[section] ||= {}
            else
              raise ConfigError, "missing close square bracket"
            end
          else
            if /\A([^:\s]*)(?:::([^:\s]*))?\s*=(.*)\z/ =~ definition
              if $2
                section = $1
                key = $2
              else
                key = $1
              end
              value = unescape_value(data, section, $3)
              (data[section] ||= {})[key] = value.strip
            else
              raise ConfigError, "missing equal sign"
            end
          end
        end
        data
      end
Register or log in to add new notes.