Module: ProperProperties::Generating::Generator
- Defined in:
- lib/proper_properties/generating/generator.rb
Overview
This module allows generating the content of a properties file base on a Properties object (or any other hash like structure)
Constant Summary collapse
- KEY_VALUE_SEPARATOR =
Character used for key-value separation
'='
- DEFAULT_OPTIONS =
Default options
{ :skip_encode_unicode => false, :skip_encode_separators => false, :skip_encode_special_chars => false }.freeze
Class Method Summary collapse
-
.generate(properties, options = {}) ⇒ String
Generates a properties file content based on a hash.
Class Method Details
.generate(properties, options = {}) ⇒ String
Generates a properties file content based on a hash
29 30 31 32 33 34 35 36 |
# File 'lib/proper_properties/generating/generator.rb', line 29 def self.generate(properties, = {}) = DEFAULT_OPTIONS.merge() lines = [] properties.each do |key, value| lines << build_line(key, value, ) end lines.join("\n") end |