Module: ProperProperties
- Defined in:
- lib/proper_properties.rb,
lib/proper_properties/version.rb,
lib/proper_properties/encoding.rb,
lib/proper_properties/properties.rb,
lib/proper_properties/parsing/parser.rb,
lib/proper_properties/encoding/unicode.rb,
lib/proper_properties/parsing/normalizer.rb,
lib/proper_properties/encoding/separators.rb,
lib/proper_properties/generating/generator.rb,
lib/proper_properties/encoding/special_chars.rb
Overview
A module to read and write Proper properties files
Defined Under Namespace
Modules: Encoding, Generating, Parsing Classes: Properties
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
-
.generate(hash, options = {}) ⇒ String
Generates the content of a Proper properties file.
-
.load(path, encoding = 'UTF-8', allow_invalid_byte_sequence = true) ⇒ Properties
Loads and parses a Proper properties file.
-
.parse(text) ⇒ Properties
Parses the content of a Proper properties file.
-
.write(hash, path, options = {}) ⇒ Object
Generates a Proper properties file.
Class Method Details
.generate(hash, options = {}) ⇒ String
Generates the content of a Proper properties file
23 24 25 |
# File 'lib/proper_properties.rb', line 23 def self.generate(hash, = {}) Generating::Generator.generate(hash, ) end |
.load(path, encoding = 'UTF-8', allow_invalid_byte_sequence = true) ⇒ Properties
Loads and parses a Proper properties file
33 34 35 |
# File 'lib/proper_properties.rb', line 33 def self.load(path, encoding = 'UTF-8', allow_invalid_byte_sequence = true) parse(File.read(path).encode(encoding, 'binary', allow_invalid_byte_sequence ? {invalid: :replace, undef: :replace} : {} )) end |
.parse(text) ⇒ Properties
Parses the content of a Proper properties file
14 15 16 |
# File 'lib/proper_properties.rb', line 14 def self.parse(text) Parsing::Parser.parse(text) end |
.write(hash, path, options = {}) ⇒ Object
Generates a Proper properties file
42 43 44 |
# File 'lib/proper_properties.rb', line 42 def self.write(hash, path, = {}) File.write(path, generate(hash, )) end |