Skip to content

fails to call superclass of wrapped method #6098

Closed
@jabamaus

Description

@jabamaus
module Wrapper
  def wrap(meth)
    define_method(meth) do |*args, **kwargs, &block|
      super(*args, **kwargs, &block)
      puts "side effect"
      self
    end
  end
end

class MyString < String
  extend Wrapper
  wrap :<<
end


MyString.new << "a"

This code prints 'side effect' in cruby but with mruby I get

test.rb:4:in <<: no superclass method 'wrap' (NoMethodError)

What's going on here? This is with latest mruby head.

Thanks :)

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