Sha256: 39ae09e78dea665eadb439d472ccac841e4648fac51772d075c43153200a1b11

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require 'stringio'
require 'java-properties/version'
require 'java-properties/properties'
require 'java-properties/encoding'
require 'java-properties/parsing'
require 'java-properties/generating'

# A module to read and write Java properties files
module JavaProperties

  # Parses the content of a Java properties file
  # @see Parsing::Parser
  # @param text [String]
  # @return [Properties]
  def self.parse(text)
    Parsing::Parser.parse(text)
  end

  # Generates the content of a Java 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 Java properties file
  # @see Parsing::Parser
  # @param path [String]
  # @return [Properties]
  def self.load(path)
    File.open(path, "r:bom|utf-8") do |f|
      parse(f.read)
    end
  end

  # Generates a Java 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

4 entries across 4 versions & 1 rubygems

Version Path
java-properties-0.3.0 lib/java-properties.rb
java-properties-0.2.1 lib/java-properties.rb
java-properties-0.2.0 lib/java-properties.rb
java-properties-0.1.1 lib/java-properties.rb