ruby-block
ruby-block copied to clipboard
Block mismatch when assigned
def foo()
bar = if true
end # highlighting this `end` shows a match on the method `def` line
end
It seems that doing an assignment from some blocks results in it not being spotted as the beginning of a block. In the above example I get def foo() as my match for the end for the if block.
edit: Thanks for making this awesome plugin!
begin/end block with assignment not detected but do/end block with assignment is
# test for block
class RubyBlock
def begin_end_block
# this block is NOT detected due to assignment
result = begin
# empty
end
puts result
end
def do_end_block
# this block is detected despite assignment
result = [].each do
# empty
end
puts result
end
end
| do-end assignment | begin-end assignment | begin-end no-assignment |
|---|---|---|
![]() |
![]() |
![]() |
+1


