Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Import in a Notebook #316

Open
Kerilk opened this issue Jan 25, 2022 · 1 comment
Open

Module Import in a Notebook #316

Kerilk opened this issue Jan 25, 2022 · 1 comment
Assignees
Labels

Comments

@Kerilk
Copy link

Kerilk commented Jan 25, 2022

Hello,

I am experiencing an issue similar to #303

I made a small github repository to reproduce the issue in binder, but this also occurs on my ubuntu 21.10 using ruby v2.7.4p191.

Here is a link to the repository:
https://github.com/Kerilk/test-ruby-binder
And to the notebook:
Module Import Notebook

Any idea of what I could be doing wrong here?

Thanks

@mrkn mrkn self-assigned this Feb 16, 2022
@mrkn mrkn added the bug label Feb 16, 2022
@mrkn
Copy link
Contributor

mrkn commented Feb 16, 2022

@Kerilk Thank you for reporting this issue. I confirmed that it is a bug that occurs only Ruby < 3.0. I'll fix it in the next version.

mrkn@mrkn-ubuntu2004:~/src/github.com/sciruby/iruby$ cat test.rb
module M
end

o = Object.new
o.extend M

o.define_singleton_method(:include) do |*args|
  M.include(*args)
end

module Foo
  def bar
    puts "baz"
  end
end

o.include(Foo)
o.bar

mrkn@mrkn-ubuntu2004:~/src/github.com/sciruby/iruby$ RBENV_VERSION=2.5 ruby -v test.rb
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
Traceback (most recent call last):
test.rb:18:in `<main>': undefined method `bar' for #<Object:0x000056020ffc99e8> (NoMethodError)

mrkn@mrkn-ubuntu2004:~/src/github.com/sciruby/iruby$ RBENV_VERSION=2.6 ruby -v test.rb
ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-linux]
test.rb:18:in `<main>': undefined method `bar' for #<Object:0x00005568e0f47088> (NoMethodError)

mrkn@mrkn-ubuntu2004:~/src/github.com/sciruby/iruby$ RBENV_VERSION=2.7 ruby -v test.rb
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
Traceback (most recent call last):
test.rb:18:in `<main>': undefined method `bar' for #<Object:0x000055805bca4bb8> (NoMethodError)

mrkn@mrkn-ubuntu2004:~/src/github.com/sciruby/iruby$ RBENV_VERSION=3.0 ruby -v test.rb
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
baz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants