15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/yard-activerecord/fields/field_handler.rb', line 15
def process
return unless statement.namespace.jump(:ident).source == 't'
method_name = call_params.first
return if method_name['_id']
ensure_loaded! P(globals.klass)
namespace = P(globals.klass)
return if namespace.nil?
method_definition = namespace.instance_attributes[method_name.to_sym] || {}
{ read: method_name, write: "#{method_name}=" }.each do |(rw, name)|
method = method_definition[rw]
if method
method.docstring.add_tag( get_tag(:return, '', class_name) ) unless method.has_tag?( :return )
next
end
rw_object = register YARD::CodeObjects::MethodObject.new(namespace, name)
rw_object.docstring = description(name)
rw_object.docstring.add_tag get_tag(:return, '', class_name)
rw_object.dynamic = true
method_definition[rw] = rw_object
end
namespace.instance_attributes[method_name.to_sym] = method_definition
end
|