Module: JavaProperties::Parsing::Parser
- Defined in:
- lib/java-properties/parsing/parser.rb
Overview
This module allows parsing of a properties file content string into a JavaProperties::Properties object
Constant Summary collapse
- KEY_VALUE_MARKER =
Symbol which separates key from value after normalization
'='
- KEY_ESCAPE =
Symbol which escapes a KEY_VALUE_MARKER in the key name
'\\'
- KEY_ONLY_MARKER =
Marker for a line which only consists of an key w/o value
/^(\S+)$/
Class Method Summary collapse
-
.parse(text) ⇒ Properties
Parses a string into a JavaProperties::Properties object.
Class Method Details
.parse(text) ⇒ Properties
Parses a string into a JavaProperties::Properties object
27 28 29 30 31 32 33 34 35 |
# File 'lib/java-properties/parsing/parser.rb', line 27 def self.parse(text) properties = Properties.new Normalizer.normalize!(text) text.each_line do |line| key, value = extract_key_and_value(line.chomp) append_to_properties(properties, key, value) end properties end |