rb_prepend_module

Function rb_prepend_module 

Source
pub unsafe extern "C" fn rb_prepend_module(
    klass: VALUE,
    module: VALUE,
)
Expand description

Identical to rb_include_module, except it “prepends” the passed module to the klass, instead of includes. This affects how super resolves. For instance:

class  Q;                def foo;      "<q/>"       end end
module W;                def foo; "<w>#{super}</w>" end end
class  E < Q; include W; def foo; "<e>#{super}</e>" end end
class  R < Q; prepend W; def foo; "<r>#{super}</r>" end end

E.new.foo # => "<e><w><q/></w></e>"
r.new.foo # => "<W><r><q/></r></w>"

§@param[out] klass Target class to modify. @param[in] module Module to prepend. @exception rb_eArgError Cyclic inclusion.

Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3