Class: YARD::Handlers::Ruby::ParameterHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/parameters/yard/handlers/ruby/parameter_handler.rb

Instance Method Summary

Instance Method Details

- (Object) process



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/parameters/yard/handlers/ruby/parameter_handler.rb', line 10

def process
  obj = statement.parameters(false).first
  nobj = namespace
  mscope = scope
  name = case obj.type
         when :symbol_literal
           obj.jump(:ident, :op, :kw, :const).source
         when :string_literal
           obj.jump(:string_content).source
         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