Sha256: 9099cc322ef33b1c561388ccc5ff320603e08bcd2b97290f9274d91e6aec34d3

Contents?: true

Size: 609 Bytes

Versions: 6

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true
module Arbre
  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

6 entries across 6 versions & 1 rubygems

Version Path
arbre-2.0.2 lib/arbre/element/proxy.rb
arbre-2.0.1 lib/arbre/element/proxy.rb
arbre-2.0.0 lib/arbre/element/proxy.rb
arbre-1.7.0 lib/arbre/element/proxy.rb
arbre-1.6.0 lib/arbre/element/proxy.rb
arbre-1.5.0 lib/arbre/element/proxy.rb