Skip to content

Unexpected return (LocalJumpError) #2438

Open
@gogainda

Description

@gogainda

throws an exception - unexpected return (LocalJumpError)

text = "not_ruby"
def parseable? text
  verbose, $VERBOSE = $VERBOSE, nil
  eval("BEGIN {return true}\n#{text}")
rescue SyntaxError
  false
ensure
  $VERBOSE = verbose
end

content = if parseable? text then
              "parseable"
          end
puts content

suprisingly MRI Ruby returns parseable which is obviously not

The code about is simplified version of this https://github.com/ruby/rdoc/blob/master/lib/rdoc/markup/to_html.rb#L214

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions