lib/fasterer/method_call.rb in fasterer-0.1.9 vs lib/fasterer/method_call.rb in fasterer-0.1.10
- old
+ new
@@ -56,11 +56,11 @@
def set_arguments
@arguments = arguments_element.map { |argument| Argument.new(argument) }
end
def set_block_presence
- if element.sexp_type == :iter
+ if element.sexp_type == :iter || (arguments.last && arguments.last.type == :block_pass)
@block_present = true
end
end
def set_block_body
@@ -69,13 +69,13 @@
end
end
# TODO: write specs for lambdas and procs
def set_block_argument_names
- @block_argument_names = if has_block? and element[2].is_a?(Sexp) # hack for lambdas
- element[2].drop(1).map { |argument| argument }
- end || []
+ @block_argument_names = if has_block? && element[2].is_a?(Sexp) # hack for lambdas
+ element[2].drop(1).map { |argument| argument }
+ end || []
end
end
# For now, used for determening if the
# receiver is a reference or a method call.
@@ -100,10 +100,9 @@
@name = reference_info[1]
end
end
class Argument
-
attr_reader :element
def initialize(element)
@element = element
end