Module: JavaProperties

Defined in:
lib/java-properties.rb,
lib/java-properties/version.rb,
lib/java-properties/encoding.rb,
lib/java-properties/properties.rb,
lib/java-properties/parsing/parser.rb,
lib/java-properties/encoding/unicode.rb,
lib/java-properties/parsing/normalizer.rb,
lib/java-properties/encoding/separators.rb,
lib/java-properties/generating/generator.rb,
lib/java-properties/encoding/special_chars.rb

Overview

A module to read and write Java properties files

Defined Under Namespace

Modules: Encoding, Generating, Parsing Classes: Properties

Constant Summary collapse

VERSION =

Current version

Returns:

  • (String)
"0.0.1".freeze

Class Method Summary collapse

Class Method Details

.generate(hash) ⇒ String

Generates the content of a Java properties file

Parameters:

  • hash (Hash)

Returns:

  • (String)

See Also:



23
24
25
# File 'lib/java-properties.rb', line 23

def self.generate(hash)
  Generating::Generator.generate(hash)
end

.load(path) ⇒ Properties

Loads and parses a Java properties file

Parameters:

  • path (String)

Returns:

See Also:



31
32
33
# File 'lib/java-properties.rb', line 31

def self.load(path)
  parse(File.read(path))
end

.parse(text) ⇒ Properties

Parses the content of a Java properties file

Parameters:

  • text (String)

Returns:

See Also:



15
16
17
# File 'lib/java-properties.rb', line 15

def self.parse(text)
  Parsing::Parser.parse(text)
end

.write(hash, path) ⇒ Object

Generates a Java properties file

Parameters:

  • hash (Hash)
  • path (String)

See Also:



39
40
41
# File 'lib/java-properties.rb', line 39

def self.write(hash, path)
  File.write(path, generate(hash))
end