Sha256: 9601de31c6543eee494b3474c73c9cb77d4385e4c9575595ef7b44ef36ba1049

Contents?: true

Size: 978 Bytes

Versions: 5

Compression:

Stored size: 978 Bytes

Contents

module RR
  module DoubleDefinitions
    class DoubleDefinitionCreateBlankSlate
      def initialize(double_definition_create, &block) #:nodoc:
        @double_definition_create = double_definition_create
        BlankSlate.call(respond_to?(:class) ? self.class : __blank_slated_class)

        if block_given?
          if block.arity == 1
            yield(self)
          else
            respond_to?(:instance_eval) ? instance_eval(&block) : __blank_slated_instance_eval(&block)
          end
        end
      end

      if KeywordArguments.fully_supported?
        def method_missing(method_name, *args, **kwargs, &block)
          @double_definition_create.call(method_name, args, kwargs, &block)
        end
      else
        def method_missing(method_name, *args, &block)
          @double_definition_create.call(method_name, args, {}, &block)
        end
      end

      def __double_definition_create__
        @double_definition_create
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rr-3.0.4 lib/rr/double_definitions/double_definition_create_blank_slate.rb
rr-3.0.3 lib/rr/double_definitions/double_definition_create_blank_slate.rb
rr-3.0.2 lib/rr/double_definitions/double_definition_create_blank_slate.rb
rr-3.0.1 lib/rr/double_definitions/double_definition_create_blank_slate.rb
rr-3.0.0 lib/rr/double_definitions/double_definition_create_blank_slate.rb