Class: Discombobulator::SuperPolymorphic

Inherits:
Object
  • Object
show all
Defined in:
lib/discombobulator/super_polymorphic.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(meth, *args, &block) ⇒ Object



2
3
4
# File 'lib/discombobulator/super_polymorphic.rb', line 2

def self.call(meth, *args, &block)
  self.new.call(meth, *args, &block)
end

Instance Method Details

#call(meth, *args, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/discombobulator/super_polymorphic.rb', line 6

def call(meth, *args, &block)
  method = find_me_a_method(meth, args.length)
  no_method_error(meth) unless method
  if $DISCOMBOBULATOR_SAFETY_FEATURE == 42
    p "Calling the BEST '##{method.name}' with #{args.inspect}"
  else
    method.call(*args, &block)
  end
end