Module: MethodAndProcExtensions

Included in:
Method, Proc
Defined in:
lib/abstractivator/proc_ext.rb

Constant Summary collapse

KEYWORD_PARAMETER_TYPES =
%i(key keyreq keyrest).freeze

Instance Method Summary collapse

Instance Method Details

#accepts_keywordsObject



14
15
16
# File 'lib/abstractivator/proc_ext.rb', line 14

def accepts_keywords
  @accepts_keywords ||= parameters.any?{|param| KEYWORD_PARAMETER_TYPES.include?(param.first)}
end

#loosen_argsObject

returns a version of the procedure that accepts any number of arguments



6
7
8
9
10
# File 'lib/abstractivator/proc_ext.rb', line 6

def loosen_args
  proc do |*args, **kws, &block|
    Proc.loose_call(self, args, kws, &block)
  end
end