lib/pg_migrate/props.rb in pg_migrate-0.1.11 vs lib/pg_migrate/props.rb in pg_migrate-0.1.12

- old
+ new

@@ -1,19 +1,19 @@ -# from comment at http://devender.wordpress.com/2006/05/01/reading-and-writing-java-property-files-with-ruby/ - -module PgMigrate - class Properties < Hash - def initialize(filename = nil) - if (filename) then - File.open(filename).select { |line| not line=~/^[ \t]*(#.+)*$/ }.# ignore comments and blank lines - each { |line| - (k, v) = line.chomp.split('=', 2) - self[k.strip] = v.strip - } - end - end - - def to_s - self.map { |k, v| " #{k}=#{v}" }.join("\n") - end - end -end +# from comment at http://devender.wordpress.com/2006/05/01/reading-and-writing-java-property-files-with-ruby/ + +module PgMigrate + class Properties < Hash + def initialize(filename = nil) + if (filename) then + File.open(filename).select { |line| not line=~/^[ \t]*(#.+)*$/ }.# ignore comments and blank lines + each { |line| + (k, v) = line.chomp.split('=', 2) + self[k.strip] = v.strip + } + end + end + + def to_s + self.map { |k, v| " #{k}=#{v}" }.join("\n") + end + end +end