Sha256: bc6bc78476f32c1448773851354054130f8ec57208e665db3da05268ac1abd03

Contents?: true

Size: 913 Bytes

Versions: 9

Compression:

Stored size: 913 Bytes

Contents

module Extensible
  ##
  # ExtensionKernelTemplate serves as the initial template for all extension kernels that are used internally by
  # Extensible. Each extensible module will extend a clone of ExtensionKernelTemplate that will allow it to execute
  # its own initialization code.
  module ExtensionKernelTemplate
    class << self
      private

      ##
      # call-seq:
      #   initialize_copy(_source) => extension_kernel_template
      #
      # Passes +_source+ to +super+ and overrides the <tt>Module#included</tt> method in order to extend self on
      # including modules.
      #
      # Returns self object.
      def initialize_copy(_source)
        super

        this_kernel = self

        define_method :included do |submodule|
          super submodule
          submodule.extend this_kernel
          self
        end

        private :included

        self
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
extensible-0.1.3 lib/extensible/extension_kernel_template.rb
extensible-0.1.2 lib/extensible/extension_kernel_template.rb
extensible-0.1.1 lib/extensible/extension_kernel_template.rb
extensible-0.1.0 lib/extensible/extension_kernel_template.rb
extensible-0.0.5 lib/extensible/extension_kernel_template.rb
extensible-0.0.4 lib/extensible/extension_kernel_template.rb
extensible-0.0.3 lib/extensible/extension_kernel_template.rb
extensible-0.0.2 lib/extensible/extension_kernel_template.rb
extensible-0.0.1 lib/extensible/extension_kernel_template.rb