Class: Bossy::MethodSignature

Inherits:
Object
  • Object
show all
Defined in:
lib/bossy/method_signature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_type, method_name, args) ⇒ MethodSignature

Returns a new instance of MethodSignature.



11
12
13
14
15
16
# File 'lib/bossy/method_signature.rb', line 11

def initialize(method_type, method_name, args)
  @type = method_type
  @name = method_name
  @name = @name.to_s if RUBY_VERSION.to_f < 1.9
  @args = args
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/bossy/method_signature.rb', line 9

def name
  @name
end

Instance Method Details

#args_to_s(args) ⇒ Object



22
23
24
# File 'lib/bossy/method_signature.rb', line 22

def args_to_s(args)
  args.map{|nt| "#{nt.first} #{nt.last}"}.join(", ")
end

#to_sObject



18
19
20
# File 'lib/bossy/method_signature.rb', line 18

def to_s
  "#{@type} #{@name}(#{args_to_s(@args)})"
end