Sha256: d6bf83a2df5deeb6d5d1187672e6a450f4f74b0d1d0715c291290d0a206a6c04

Contents?: true

Size: 459 Bytes

Versions: 4

Compression:

Stored size: 459 Bytes

Contents

module MotionBindable

  # This allows objects to register multiple delegates
  class DelegateProxy

    attr_accessor :delegates

    def initialize(*initial_delegates)
      self.delegates = initial_delegates
    end

    def method_missing(name, *args, &block)
      responses = []
      delegates.each do |delegate|
        responses << delegate.send(name, *args, &block) if delegate.respond_to?(name)
      end

      responses.first
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion_bindable-0.0.4 lib/motion_bindable/delegate_proxy.rb
motion_bindable-0.0.3 lib/motion_bindable/delegate_proxy.rb
motion_bindable-0.0.2 lib/motion_bindable/delegate_proxy.rb
motion_bindable-0.0.1 lib/motion_bindable/delegate_proxy.rb