Sha256: 6a51443995220f747b29690c9e79f88b51f997d29ebe52d543eb4924a4277533

Contents?: true

Size: 525 Bytes

Versions: 2

Compression:

Stored size: 525 Bytes

Contents

module Decorum
  class CallableDecorator
    def initialize(decorator)
      @_decorator = decorator
    end

    # tortuously named to avoid conflict and discourage use
    def _actual_decorator
      @_decorator
    end
    
    def method_missing(message, *args, &block)
      response = catch :chain_stop do
        @_decorator.send(message, *args, &block)
      end
      if response.is_a?(Decorum::ChainStop)
        @_decorator.root.send(message, *args, &block)
      else
        response
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decorum-0.5.1 lib/decorum/callable_decorator.rb
decorum-0.5.0 lib/decorum/callable_decorator.rb