Class: PropertiesReader
- Inherits:
-
Object
- Object
- PropertiesReader
- Defined in:
- lib/rack2aws/props_reader.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(file) ⇒ PropertiesReader
constructor
A new instance of PropertiesReader.
- #to_s ⇒ Object
Constructor Details
#initialize(file) ⇒ PropertiesReader
Returns a new instance of PropertiesReader.
2 3 4 5 6 7 8 |
# File 'lib/rack2aws/props_reader.rb', line 2 def initialize(file) @file = file @properties = {} IO.foreach(file) do |line| @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\/\/(.*)/ || line =~ /([^=]*)=(.*)/ end end |
Instance Method Details
#get(key) ⇒ Object
16 17 18 |
# File 'lib/rack2aws/props_reader.rb', line 16 def get(key) @properties[key].strip end |
#to_s ⇒ Object
10 11 12 13 14 |
# File 'lib/rack2aws/props_reader.rb', line 10 def to_s output = "File Name #{@file} \n" @properties.each {|key,value| output += "#{key}= #{value} \n"} output end |