module AyeCommander::Shareable::ClassMethods

This module serves to make sure that when included or inherited everything related to the command is preserved Prepend is not really supported, but you really shouldnt be prepending a command so… meh

Public Instance Methods

included(includer) click to toggle source

This ensures that class methods are extended when Command is included

Calls superclass method
# File lib/aye_commander/shareable.rb, line 9
def included(includer)
  super
  includer.extend AyeCommander::Command::ClassMethods
  %i[@limiters @succeeds @hooks].each do |var|
    if instance_variable_defined? var
      includer.instance_variable_set var, instance_variable_get(var).dup
    end
  end
end
inherited(inheriter) click to toggle source

Rubys object model already links the ancestry path of singleton classes when using classic inheritance so no need to extend. Just need to add the variables to the inheriter.

Calls superclass method
# File lib/aye_commander/shareable.rb, line 22
def inherited(inheriter)
  super
  %i[@limiters @succeeds @hooks].each do |var|
    if instance_variable_defined? var
      inheriter.instance_variable_set var, instance_variable_get(var).dup
    end
  end
end