Skip to content

Instantly share code, notes, and snippets.

@skylerto
Created May 11, 2017 12:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skylerto/f61f1347d41e334ef4aa4c5fb98a5cca to your computer and use it in GitHub Desktop.
Save skylerto/f61f1347d41e334ef4aa4c5fb98a5cca to your computer and use it in GitHub Desktop.
module Properties
class << self
def load_properties(properties_filename)
properties = {}
File.open(properties_filename, 'r') do |properties_file|
properties_file.read.each_line do |line|
line.strip!
if (line[0] != ?# and line[0] != ?=)
i = line.index('=')
if (i)
properties[line[0..i - 1].strip] = line[i + 1..-1].strip
else
properties[line] = ''
end
end
end
end
properties
end
end
end
puts Properties.load_properties ARGV[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment