Class: MethodSig::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/decompiler/method/signature/signature.rb

Overview

An abstraction for a method signature.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin_class, name, arg_names, args) ⇒ Signature

Returns a new instance of Signature.



6
7
8
9
10
11
# File 'lib/decompiler/method/signature/signature.rb', line 6

def initialize(origin_class, name, arg_names, args)
  @origin_class = origin_class
  @name = name
  @arg_names = arg_names
  @args = args
end

Instance Attribute Details

#arg_namesObject (readonly)

Returns the value of attribute arg_names.



4
5
6
# File 'lib/decompiler/method/signature/signature.rb', line 4

def arg_names
  @arg_names
end

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/decompiler/method/signature/signature.rb', line 4

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/decompiler/method/signature/signature.rb', line 4

def name
  @name
end

#origin_classObject (readonly)

Returns the value of attribute origin_class.



4
5
6
# File 'lib/decompiler/method/signature/signature.rb', line 4

def origin_class
  @origin_class
end

Instance Method Details

#param_listObject



17
18
19
20
# File 'lib/decompiler/method/signature/signature.rb', line 17

def param_list
  params = @arg_names.map{ |n| args[n].to_s }
  return params.join(', ')
end

#to_sObject



13
14
15
# File 'lib/decompiler/method/signature/signature.rb', line 13

def to_s
  return "#{@origin_class}\##{@name}(#{param_list})"
end