Sha256: 15581851c616efb556554aaec9f8e0299dc854575d0d94504c24152c22c07c41
Contents?: true
Size: 897 Bytes
Versions: 2
Compression:
Stored size: 897 Bytes
Contents
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::H level: 1 text: class_extension - !ruby/struct:SM::Flow::P body: "Normally when including modules, class/module methods are not extended. To achieve this behavior requires some clever Ruby Karate. Instead class_extension provides an easy to use and clean solution. Simply place the extending class methods in a block of the special module method #class_extension." - !ruby/struct:SM::Flow::VERB body: " module Mix\n def inst_meth\n puts 'inst_meth'\n end\n\n class_extension do\n def class_meth\n "Class Method!"\n end\n end\n end\n\n class X\n include Mix\n end\n\n X.class_meth #=> "Class Method!"\n" full_name: Module#class_extension is_singleton: false name: class_extension params: (&block) visibility: private
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.4.2 | doc/ri/Module/class_extension-i.yaml |
facets-2.4.3 | doc/ri/Module/class_extension-i.yaml |