module Aws::Templates::Utils::Inheritable::ClassMethods

Core class-level mixins

Contains core logic of the inheritance feature. This module is used as extention in every including module/class to expose appropriate module-level primitives for handling inheritance of class-scope methods.

Public Instance Methods

_class_scope_defined?() click to toggle source
# File lib/aws/templates/utils/inheritable.rb, line 43
def _class_scope_defined?
  @class_scope_defined || false
end
_define_class_scope() click to toggle source
# File lib/aws/templates/utils/inheritable.rb, line 47
def _define_class_scope
  const_set(:ClassScope, ClassScope.dup)
  @class_scope_defined = true
end
class_scope(&blk) click to toggle source
# File lib/aws/templates/utils/inheritable.rb, line 36
def class_scope(&blk)
  raise ScriptError.new('class_scope should have a block') if blk.nil?
  _define_class_scope unless _class_scope_defined?
  ClassScope.module_eval(&blk)
  extend ClassScope
end
included(base) click to toggle source

To add class methods also while including the module

Calls superclass method
# File lib/aws/templates/utils/inheritable.rb, line 26
def included(base)
  super(base)
  base.extend(ClassMethods)
  base.extend(ClassScope)
end
instance_scope(&blk) click to toggle source
# File lib/aws/templates/utils/inheritable.rb, line 32
def instance_scope(&blk)
  module_eval(&blk)
end