Sha256: d428525a514532570cf5a6f8f8c4ea7fc02aa2744f284f6cf3898542c8072d19
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require 'proper_properties/version' require 'proper_properties/properties' require 'proper_properties/encoding' require 'proper_properties/parsing' require 'proper_properties/generating' # A module to read and write Proper properties files module ProperProperties # Parses the content of a Proper properties file # @see Parsing::Parser # @param text [String] # @return [Properties] def self.parse(text) Parsing::Parser.parse(text) end # Generates the content of a Proper properties file # @see Generating::Generator # @param hash [Hash] # @param options [Hash] options for the generator # @return [String] def self.generate(hash, options = {}) Generating::Generator.generate(hash, options) end # Loads and parses a Proper properties file # @see Parsing::Parser # @param path [String] # @param encoding [String] # @param allow_invalid_byte_sequence [Boolean] # @return [Properties] 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 # Generates a Proper properties file # @see Generating::Generator # @param hash [Hash] # @param path [String] # @param options [Hash] options for the generator def self.write(hash, path, options = {}) File.write(path, generate(hash, options)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proper_properties-0.0.2 | lib/proper_properties.rb |
proper_properties-0.0.1 | lib/proper_properties.rb |