Class: Undo::Wrapper

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/undo/wrapper.rb,
lib/undo/wrapper/configuration.rb

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, options) ⇒ Wrapper

Returns a new instance of Wrapper.



21
22
23
24
25
26
27
# File 'lib/undo/wrapper.rb', line 21

def initialize(object, options)
  @object = object
  @config = Undo::Wrapper.config.with options
  @options = options

  super object
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



29
30
31
32
# File 'lib/undo/wrapper.rb', line 29

def method_missing(method, *args, &block)
  store if config.store_on.include? method
  super method, *args, &block
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/undo/wrapper.rb', line 19

def config
  @config
end

#undo_uuidObject (readonly)

Returns the value of attribute undo_uuid.



19
20
21
# File 'lib/undo/wrapper.rb', line 19

def undo_uuid
  @undo_uuid
end

Class Method Details

.configObject



12
13
14
# File 'lib/undo/wrapper.rb', line 12

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



8
9
10
# File 'lib/undo/wrapper.rb', line 8

def self.configure
  yield config
end