Class: YARD::Parameters::Legacy::ParameterHandler

Inherits:
Handlers::Ruby::Legacy::Base
  • Object
show all
Defined in:
lib/yard-parameters/legacy/parameter_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
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/yard-parameters/legacy/parameter_handler.rb', line 8

def process
  nobj = namespace
  mscope = scope
  name = statement.tokens[2,1].to_s[1..-1]

  register MethodObject.new(nobj, name, :class) do |o|
    o.visibility = :public
    o.source = statement.source
    o.signature = "def #{nobj}.#{name}"
  end

  register MethodObject.new(nobj, "#{name}=", :class) do |o|
    o.visibility = :public
    o.source = statement.source
    o.signature = "def #{nobj}.#{name}=(value)"
    o.parameters = [['value', nil]]
  end

  register MethodObject.new(nobj, name, mscope) do |o|
    o.visibility = :public
    o.source = statement.source
    o.signature = "def #{name}"
  end

  register MethodObject.new(nobj, "#{name}=", mscope) do |o|
    o.visibility = :public
    o.source = statement.source
    o.signature = "def #{name}=(value)"
    o.parameters = [['value', nil]]
  end
end