Class: Fastererer::MethodCall

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ MethodCall

Returns a new instance of MethodCall.



9
10
11
12
13
14
15
16
17
18
# File 'lib/fastererer/method_call.rb', line 9

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.



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

def arguments
  @arguments
end

#block_argument_namesObject (readonly)

Returns the value of attribute block_argument_names.



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

def block_argument_names
  @block_argument_names
end

#block_bodyObject (readonly)

Returns the value of attribute block_body.



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

def block_body
  @block_body
end

#elementObject (readonly)

Returns the value of attribute element.



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

def element
  @element
end

#method_nameObject (readonly) Also known as: name

Returns the value of attribute method_name.



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

def method_name
  @method_name
end

#receiverObject (readonly)

Returns the value of attribute receiver.



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

def receiver
  @receiver
end

Instance Method Details

#arguments_elementObject



28
29
30
# File 'lib/fastererer/method_call.rb', line 28

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

#block?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fastererer/method_call.rb', line 20

def block?
  @block_present || false
end

#lambda_literal?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/fastererer/method_call.rb', line 32

def lambda_literal?
  call_element.sexp_type == :lambda
end

#receiver_elementObject



24
25
26
# File 'lib/fastererer/method_call.rb', line 24

def receiver_element
  call_element[1]
end