Class: Svn::Log::Properties

Inherits:
Object
  • Object
show all
Defined in:
lib/svnlog/index.rb

Overview

A set of persistent properties

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Properties

Returns a new instance of Properties.



86
87
88
89
90
91
92
93
94
# File 'lib/svnlog/index.rb', line 86

def initialize(path = nil)
  @data = {}
  @path = path
  if @path && File.exists?(@path)
    File.open(@path) do |file|
      @data = YAML.load(file)
    end
  end
end

Instance Method Details

#[](name) ⇒ Object



96
97
98
# File 'lib/svnlog/index.rb', line 96

def [](name)
  @data[name]
end

#[]=(name, value) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/svnlog/index.rb', line 100

def []=(name, value)
  @data[name] = value
  if @path
    File.open(@path, "w") do |file|
      YAML.dump(@data, file)
    end
  end
end