Class: QB::Util::Decorators::NoPropsInKwds

Inherits:
MethodDecorators::Decorator
  • Object
show all
Defined in:
lib/qb/util/decorators.rb

Overview

Don't all NRSER::Props arguments in last position to become keyword options.

Since NRSER::Props objects can be subclasses of Hash, etc., they can erroneously end up being considered keyword options.

This decorator prevents that. If you want to pass an NRSER::Props as the keywords, calling #to_h or something on it first should work.

Instance Method Summary collapse

Instance Method Details

#call(target, receiver, *args, &block) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/qb/util/decorators.rb', line 90

def call target, receiver, *args, &block
  if args.last.is_a? NRSER::Props
    target.call *args, {}, &block
  else
    target.call *args, &block
  end
end