Module: JavaProperties::Generating::Generator

Defined in:
lib/java-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)

Examples:

Generator.generate({:item => "something ה"}) => "item=something \u05d4"

Constant Summary collapse

KEY_VALUE_SEPARATOR =

Character used for key-value separation

Returns:

  • (String)
'='

Class Method Summary collapse

Class Method Details

.generate(properties) ⇒ String

Generates a properties file content based on a hash

Parameters:

Returns:

  • (String)


17
18
19
20
21
22
23
# File 'lib/java-properties/generating/generator.rb', line 17

def self.generate(properties)
  lines = []
  properties.each do |key, value|
    lines << build_line(key, value)
  end
  lines.join("\n")
end