Skip to content

Doesn't work direct from Ruby CLI #31

@Fryguy

Description

@Fryguy

As a test, I tried the following

foo.rb:

class Foo
  3.times |x|
    puts x
  end
end

And none of the following work

$ ruby -r dead_end foo.rb
foo.rb:6: syntax error, unexpected end, expecting end-of-input
$ ruby -r dead_end -c foo.rb
foo.rb:6: syntax error, unexpected end, expecting end-of-input

I assume this is probably a Ruby ordering thing in that it parses your script before applying the requires, but it's very surprising.

If instead, I do this, it works fine.

bar.rb:

require "foo"

Not sure if there's an actual fix that can be done if this is a Ruby core issue, but wanted to bring to your attention, particularly since one of your goals is eventually getting this into ruby core in a similar way to did_you_mean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions