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

Version Path
pg_migrate-0.1.14 lib/pg_migrate/props.rb
pg_migrate-0.1.13 lib/pg_migrate/props.rb
pg_migrate-0.1.12 lib/pg_migrate/props.rb
pg_migrate-0.1.7 lib/pg_migrate/props.rb
pg_migrate-0.1.6 lib/pg_migrate/props.rb
pg_migrate-0.1.5 lib/pg_migrate/props.rb
pg_migrate-0.1.4 lib/pg_migrate/props.rb
pg_migrate-0.1.3 lib/pg_migrate/props.rb
pg_migrate-0.1.2 lib/pg_migrate/props.rb
pg_migrate-0.1.1 lib/pg_migrate/props.rb
pg_migrate-0.1.0 lib/pg_migrate/props.rb