Class: ID3Tag::Configuration
- Inherits:
-
Object
- Object
- ID3Tag::Configuration
- Includes:
- Singleton
- Defined in:
- lib/id3tag/configuration.rb
Defined Under Namespace
Classes: StackItem
Constant Summary collapse
- ResetError =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.configuration {|value| ... } ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/id3tag/configuration.rb', line 12 def configuration value_from_stack = instance.instance_variable_get(:@stack).last value = value_from_stack && value_from_stack.configuration value ||= instance.instance_variable_get(:@global_configuration) yield value if block_given? value end |
.local_configuration(&blk) ⇒ Object
8 9 10 |
# File 'lib/id3tag/configuration.rb', line 8 def local_configuration(&blk) instance.send(:local_configuration, &blk) end |
.reset ⇒ Object
20 21 22 |
# File 'lib/id3tag/configuration.rb', line 20 def reset instance.send(:reset) end |
Instance Method Details
#local_configuration ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/id3tag/configuration.rb', line 25 def local_configuration instance_to_copy = @stack.last && @stack.last.configuration instance_to_copy ||= @global_configuration stack_item = StackItem.new(instance_to_copy.dup) stack_backup = @stack.dup @stack << stack_item begin yield stack_item.configuration ensure @stack.replace stack_backup end end |