Class: YARD::DM::Predefined::PredefineHandler

Inherits:
Handlers::Ruby::Base
  • Object
show all
Defined in:
lib/yard-dm-predefined/predefine_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
# File 'lib/yard-dm-predefined/predefine_handler.rb', line 8

def process
  nobj = namespace
  name = if statement.type == :predefine
           statement.jump(:ident, :op, :kw, :const).source
         elsif statement.call?
           obj = statement.parameters(false).first

           case obj.type
           when :symbol_literal
             obj.jump(:ident, :op, :kw, :const).source
           when :string_literal
             obj.jump(:string_content).source
           end
         end

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