Created
May 11, 2017 12:36
-
-
Save skylerto/f61f1347d41e334ef4aa4c5fb98a5cca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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