Module: Arguments

Defined in:
lib/__arguments__.rb,
lib/__arguments__/version.rb

Constant Summary collapse

VERSION =
'0.1.1'

Instance Method Summary collapse

Instance Method Details

#__arguments__(bdg) ⇒ Array

Returns an array indicating the arguments given tothe current method.

Parameters:

  • bdg (Binding)

    binding in the current scope

Returns:

  • (Array)

    array of 2-element arrys of the form ‘[symbol, value]`



6
7
8
9
# File 'lib/__arguments__.rb', line 6

def __arguments__(bdg)
  method_symbol = caller(1,1).first.match(/\`(?<name>[^']*)'/)[:name].to_sym
  self.method(method_symbol).parameters.map { |e| [e[1], bdg.local_variable_get(e[1])] }
end