Module: Cleanroom::ClassMethods

Defined in:
lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb

Overview

Add kwargs support

Instance Method Summary collapse

Instance Method Details

#expose(name) ⇒ Object

Expose the given method to the DSL.

Parameters:

  • name (Symbol)

Raises:

  • (NameError)


15
16
17
18
19
20
# File 'lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb', line 15

def expose(name)
  raise NameError, "undefined method `#{name}' for class `#{self.name}'" unless public_method_defined?(name)

  exposed_methods_with_kwargs[name] = true if instance_method(name).parameters.any? { |(arg_type, _arg_name)| KWARGS_TYPES.include?(arg_type) }
  exposed_methods[name] = true
end