Sha256: dea60bcfa00497135daa543ece2bb7b69afada8202c1394abbf26b00dc4aed12

Contents?: true

Size: 578 Bytes

Versions: 3

Compression:

Stored size: 578 Bytes

Contents

module Arbo
  class Element
    class Proxy < BasicObject
      undef_method :==
      undef_method :equal?

      def initialize(element)
        @element = element
      end

      def respond_to?(method, include_all = false)
        if method.to_s == 'to_ary'
          false
        else
          super || @element.respond_to?(method, include_all)
        end
      end

      def method_missing(method, *args, &block)
        if method.to_s == 'to_ary'
          super
        else
          @element.__send__ method, *args, &block
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arbo-1.3.1 lib/arbo/element/proxy.rb
arbo-1.3.0 lib/arbo/element/proxy.rb
arbo-1.2.0 lib/arbo/element/proxy.rb