Class: Blender::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/blender/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



27
28
29
30
# File 'lib/blender/configuration.rb', line 27

def initialize
  @mutex = Mutex.new
  reset!
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



25
26
27
# File 'lib/blender/configuration.rb', line 25

def data
  @data
end

#mutexObject (readonly)

Returns the value of attribute mutex.



25
26
27
# File 'lib/blender/configuration.rb', line 25

def mutex
  @mutex
end

Class Method Details

.[](key) ⇒ Object



38
39
40
41
42
# File 'lib/blender/configuration.rb', line 38

def self.[](key)
  instance.mutex.synchronize do
    instance.data[key]
  end
end

.[]=(key, value) ⇒ Object



32
33
34
35
36
# File 'lib/blender/configuration.rb', line 32

def self.[]=(key, value)
  instance.mutex.synchronize do
    instance.data[key] = value
  end
end

.reset!Object



44
45
46
47
48
# File 'lib/blender/configuration.rb', line 44

def self.reset!
  instance.mutex.synchronize do
    instance.reset!
  end
end

Instance Method Details

#reset!Object



50
51
52
53
54
# File 'lib/blender/configuration.rb', line 50

def reset!
  @data = Hash.new{|h, k| h[k] = Hash.new}
  @data[:noop] = false
  @data[:arguments] = []
end