Module: YamlMaster::PropertyParser
- Defined in:
- lib/yaml_master.rb
Defined Under Namespace
Classes: ParseError
Class Method Summary collapse
Class Method Details
.parse_properties(property_strings_or_hash) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/yaml_master.rb', line 94 def self.parse_properties(property_strings_or_hash) if property_strings_or_hash.is_a?(Hash) property_strings_or_hash else property_strings_or_hash.each_with_object({}) do |str, hash| key, value = str.split("=") raise ParseError.new("#{str} is invalid format") unless key && value hash[key] = value end end end |