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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/roby/yard.rb', line 17
def process
name = statement.parameters[0].jump(:tstring_content, :ident).source
push_state(scope: :class) do
object = YARD::CodeObjects::MethodObject.new(namespace, "#{name}_sets", scope)
object.dynamic = true
register(object)
object.docstring.replace(
YARD::Docstring.new("The set of #{name}s defined at this level of the model hierarchy") +
object.docstring)
object.docstring.add_tag(
*YARD::Docstring.parser.create_tag("return", "[Hash<Symbol,Set<Symbol>>]"))
object = YARD::CodeObjects::MethodObject.new(namespace, "each_#{name}_set", scope)
object.dynamic = true
register(object)
object.docstring.add_tag(
*YARD::Docstring.parser.create_tag("yieldparam", "[Symbol] source_name"),
*YARD::Docstring.parser.create_tag("yieldparam", "[Set<Symbol>] target_names"))
object = YARD::CodeObjects::MethodObject.new(namespace, "#{name}s", scope)
object.dynamic = true
register(object)
object.parameters << ["model", nil]
object.docstring.add_tag(
*YARD::Docstring.parser.create_tag("param", "[Symbol] event_name"),
*YARD::Docstring.parser.create_tag("return", "[Set<Symbol>] target #{name}s"))
object = YARD::CodeObjects::MethodObject.new(namespace, "each_#{name}", scope)
object.dynamic = true
register(object)
object.parameters << ["model", nil]
object.docstring.add_tag(
*YARD::Docstring.parser.create_tag("param", "[Symbol] event_name"),
*YARD::Docstring.parser.create_tag("yieldparam", "[Symbol] target_name"))
object = YARD::CodeObjects::MethodObject.new(namespace, "all_#{name}s", scope)
object.dynamic = true
register(object)
object.parameters << ["model", nil]
object.docstring.replace(
YARD::Docstring.new("The set of #{name}s that will be applied on all instances of this model") +
object.docstring)
object.docstring.add_tag(
*YARD::Docstring.parser.create_tag("return", "[Hash<Symbol,Set<Symbol>>]"))
end
end
|