Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ProcSource.find fixed curly braces problem

  • Loading branch information...
commit 903e5dc8303bb7c1ad0dfaaac5a59091d95fa74e 1 parent 4e183a7
@notro notro authored
Showing with 4 additions and 2 deletions.
  1. +4 −0 lib/proc_source.rb
  2. +0 −2  spec/lib_proc_source_spec.rb
View
4 lib/proc_source.rb
@@ -93,6 +93,8 @@ def self.find(filename, start_line=0, block_only=true)
break
end
nesting -= 1
+ elsif RubyToken::TkLBRACE === token
+ nesting += 1
elsif RubyToken::TkBITOR === token && stoken
#nothing
elsif RubyToken::TkNL === token && stoken && etoken
@@ -138,6 +140,8 @@ def self.line_has_open?(str)
break
when RubyToken::TkDO
success = true
+ when RubyToken::TkfLBRACE
+ success = true
when RubyToken::TkCONSTANT
if token.name == "Proc" &&
lexer.token.is_a?(RubyToken::TkDOT)
View
2  spec/lib_proc_source_spec.rb 100644 → 100755
@@ -127,11 +127,9 @@ def block_method(&block)
end
it "should handle a {} block passed to a method" do
-pending "This currently fails on ruby 1.9. It returns the surrounding block."
block_method {
false
}
-# puts @block.source
@block.source.split.join(' ').should == "{ false }"
end
Please sign in to comment.
Something went wrong with that request. Please try again.