Class: JavaBuildpackUtils::Properties

Inherits:
Hash
  • Object
show all
Defined in:
lib/java-buildpack-utils/properties.rb

Overview

A class representing a collection of Java properties

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Properties

Create a new instance, populating it with values from a properties file

Parameters:

  • file (String)

    the file to use for initialization



22
23
24
25
26
27
28
29
30
# File 'lib/java-buildpack-utils/properties.rb', line 22

def initialize(file)
  File.foreach(file) do |line|
    unless blank_line?(line) || comment_line?(line)
      if line =~ /^[\s]*([^:=\s]+)[\s]*[=:]?[\s]*([^:=\s]*)$/
        self[$1] = $2
      end
    end
  end
end