Module: Inclusive

Extended by:
Public
Defined in:
lib/inclusive.rb,
lib/inclusive/version.rb

Overview

Include this in any class so you have access to the ‘packages` method (both class and instance).

Defined Under Namespace

Modules: Class, ModuleWithPackages, Public

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Public

public_function

Class Method Details

.included(klass) ⇒ Object



109
110
111
# File 'lib/inclusive.rb', line 109

def self.included(klass)
  klass.extend self::Class
end

Instance Method Details

#packagesModuleWithPackages

Returns a blank module ready for package imports, useful for inline package access when an instance method is not suitable (perhaps you’re in a template or block context).

Returns:



117
118
119
120
121
# File 'lib/inclusive.rb', line 117

def packages = ModuleWithPackages.dup.tap do |mod|
  mod.module_eval do
    def self.name = "ModuleWithPackages" # preserve module name
  end
end