Class: MetaBuild::Helper::PropertiesHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_build/helper/properties_helper.rb

Class Method Summary collapse

Class Method Details

.load(file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/meta_build/helper/properties_helper.rb', line 7

def load(file)
  return unless File.exist? file.to_s
  props = Hash.new

  File.readlines(file).each do |line|
    line.strip!
    next if (line.start_with? '#') || (line.empty?)

    kv = line.split '='
    props[kv.first.rstrip] = kv.last.lstrip
  end

  props
end