Sha256: 5c06537620abf439c0e74bf2eba3fbe92f868a63d6b7809e96369c9bd6c9d180
Contents?: true
Size: 1013 Bytes
Versions: 2
Compression:
Stored size: 1013 Bytes
Contents
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Combine modules. - !ruby/struct:SM::Flow::VERB body: " module A\n def a; "a"; end\n end\n\n module B\n def b; "b"; end\n end\n\n C = A + B\n\n class X; include C; end\n\n X.new.a #=> "a"\n X.new.b #=> "b"\n" - !ruby/struct:SM::Flow::P body: Note that in the old version of traits.rb we cloned modules and altered their copies. Eg. - !ruby/struct:SM::Flow::VERB body: " def +(other)\n mod1 = other.clone\n mod2 = clone\n mod1.module_eval{ include mod2 }\n end\n" - !ruby/struct:SM::Flow::P body: Later it was realized that this thwarted the main benefit that Ruby's concept of modules has over traditional traits, inheritance. - !ruby/struct:SM::Flow::VERB body: " CREDIT: Thomas Sawyer\n CREDIT: Robert Dober\n" full_name: Module#+ is_singleton: false name: + params: (other) visibility: public
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.4.2 | doc/ri/Module/%2b-i.yaml |
facets-2.4.3 | doc/ri/Module/%2b-i.yaml |