Sha256: 9e70662cc95522dce3ad675bb5af0e401c1f075ae7378b4bd27f0dda1f46bbca

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

module VORuby
  module Misc
    module PropertyFile
  
      # A *very* simple property file reader.
      # It can only understand files with entries
      # of the property=value format--nothing fancy.
      class SimpleReader
        def initialize(file_name)
          @file_name = file_name
          load()
        end
    
        def load
          @properties = {}
          File.open(@file_name) do |file|
            file.each do |line|
              line.lstrip!
              if line !~ /^\#/
                key, value = line.split(/\s*=\s*/, 2)
                @properties[key] = value
              end
            end
          end
        end
    
        def [](name)
          @properties[name]
        end
    
        private :load
      end
  
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voruby-1.0.2 lib/voruby/misc/propertyfile.rb
voruby-1.1 lib/voruby/misc/propertyfile.rb
voruby-1.0.1 lib/voruby/misc/propertyfile.rb
voruby-1.1.1 lib/voruby/misc/propertyfile.rb