Skip to content

'uninitialized constant' error at Kernel method #1152

@akiray03

Description

@akiray03
  • The following codes cannot be executed by mruby.
module Kernel
  def test
    [1,2,3].map do |t|
      Object
    end
  end
end
p test
  # mruby => t.rb:5: uninitialized constant Object (NameError)
  # ruby => [Object, Object, Object]
  • On the other hand, the next code can be executed by mruby.
module Hoge
  def test
    [1,2,3].map do |t|
      Object
    end
  end
end

class Test
  include Hoge
end

p Test.new.test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions