Method: Innate::Node#update_method_arities

Defined in:
lib/innate/node.rb

#update_method_aritiesHash

Answer with a hash, keys are method names, values are method arities.

Note that this will be executed once for every request, once we have settled things down a bit more we can switch to update based on Reloader hooks and update once on startup. However, that may cause problems with dynamically created methods, so let’s play it safe for now.

Examples:


Hi.update_method_arities
# => {'index' => 0, 'foo' => -1, 'bar' => 2}

See Also:



533
534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/innate/node.rb', line 533

def update_method_arities
  @method_arities = {}

  exposed = ancestors & Helper::EXPOSE.to_a
  higher = ancestors.select{|ancestor| ancestor < Innate::Node }

  (higher + exposed).reverse_each do |ancestor|
    ancestor.public_instance_methods(false).each do |im|
      @method_arities[im.to_s] = ancestor.instance_method(im).arity
    end
  end

  @method_arities
end