Class: Fasterer::MethodCall

Inherits:
Object
  • Object
show all
Defined in:
lib/fasterer/method_call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ MethodCall

Returns a new instance of MethodCall.



12
13
14
15
16
17
18
19
20
21
# File 'lib/fasterer/method_call.rb', line 12

def initialize(element)
  @element = element
  set_call_element
  set_receiver
  set_method_name
  set_arguments
  set_block_presence
  set_block_body
  set_block_argument_names
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



6
7
8
# File 'lib/fasterer/method_call.rb', line 6

def arguments
  @arguments
end

#block_argument_namesObject (readonly)

Returns the value of attribute block_argument_names.



8
9
10
# File 'lib/fasterer/method_call.rb', line 8

def block_argument_names
  @block_argument_names
end

#block_bodyObject (readonly)

Returns the value of attribute block_body.



7
8
9
# File 'lib/fasterer/method_call.rb', line 7

def block_body
  @block_body
end

#elementObject (readonly)

Returns the value of attribute element.



3
4
5
# File 'lib/fasterer/method_call.rb', line 3

def element
  @element
end

#method_nameObject (readonly) Also known as: name

Returns the value of attribute method_name.



5
6
7
# File 'lib/fasterer/method_call.rb', line 5

def method_name
  @method_name
end

#receiverObject (readonly)

Returns the value of attribute receiver.



4
5
6
# File 'lib/fasterer/method_call.rb', line 4

def receiver
  @receiver
end

Instance Method Details

#arguments_elementObject



31
32
33
# File 'lib/fasterer/method_call.rb', line 31

def arguments_element
  call_element.sexp_body(3) || []
end

#has_block?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/fasterer/method_call.rb', line 23

def has_block?
  @block_present || false
end

#lambda_literal?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fasterer/method_call.rb', line 35

def lambda_literal?
  call_element.sexp_type == :lambda
end

#receiver_elementObject



27
28
29
# File 'lib/fasterer/method_call.rb', line 27

def receiver_element
  call_element[1]
end