Sha256: dc1dbb5f5dec711382923df7c3a6945539eea211bbbc95d654b7d40c4a1170ee
Contents?: true
Size: 531 Bytes
Versions: 11
Compression:
Stored size: 531 Bytes
Contents
# 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
Version data entries
11 entries across 11 versions & 1 rubygems