Class: YARD::Handlers::Ruby::ActiveRecord2::Delegations::DelegateHandler

Inherits:
MethodHandler
  • Object
show all
Defined in:
lib/yard-activerecord2/delegations/delegate_handler.rb

Instance Method Summary collapse

Instance Method Details

#processObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yard-activerecord2/delegations/delegate_handler.rb', line 8

def process
  params = call_params
  class_name = params.pop
  class_name = class_name[:to] if class_name.is_a?(Hash)
  class_name.capitalize!
  params.each do |method_name|
    object = YARD::CodeObjects::MethodObject.new(namespace, method_name)
    object.group = "Delegated Instance Attributes"
    object.docstring = "Please refer to {#{class_name}##{method_name}}"
    object.docstring.add_tag get_tag(:return,
        "{#{class_name}##{method_name}}", 'Object')
    object.docstring.add_tag get_tag(:see,
        "http://api.rubyonrails.org/classes/Module.html#method-i-delegate")
    register object
  end
  group_name = "Delegated Instance Attributes"
  namespace.groups << group_name unless namespace.groups.include? group_name
end