Module: Boson::MethodInspector::API

Included in:
Boson::MethodInspector
Defined in:
lib/boson/method_inspector.rb

Instance Method Summary collapse

Instance Method Details

#during_new_method_added(mod, meth) ⇒ Object

Method hook called during new_method_added



88
# File 'lib/boson/method_inspector.rb', line 88

def during_new_method_added(mod, meth); end

#has_inspector_method?(meth, inspector) ⇒ Boolean

Determines if method’s arguments should be scraped

Returns:

  • (Boolean)


106
107
108
# File 'lib/boson/method_inspector.rb', line 106

def has_inspector_method?(meth, inspector)
  true
end

#set_arguments(mod, meth) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/boson/method_inspector.rb', line 90

def set_arguments(mod, meth)
  store[:args] ||= {}

  args = mod.instance_method(meth).parameters.map do|(type, name)|
    case type
    when :rest then ["*#{name}"]
    when :req  then [name.to_s]
    when :opt  then [name.to_s, '']
    else nil
    end
  end.compact

  store[:args][meth.to_s] = args
end