module DslOrganizer::ExportCommand

It allows to define what a class is a executor (hook). @note Just include this to the target class and think up a command name. @example

include DslOrganizer::ExportCommand[:after]

rubocop:disable Metrics/MethodLength

Public Class Methods

[](command_name) click to toggle source
# File lib/dsl_organizer/export_command.rb, line 8
def self.[](command_name)
  Module.new do
    @command_name = command_name

    def self.included(base)
      if ExportContainer[@command_name].nil?
        ExportContainer[@command_name] = base
      else
        raise(
          Errors::ExecutorDidMountEarly,
          "The component for command name: `#{@command_name}`" \
          ' was mounted early. Avoid duplication naming within commands.'
        )
      end
    end
  end
end
included(base) click to toggle source
# File lib/dsl_organizer/export_command.rb, line 12
def self.included(base)
  if ExportContainer[@command_name].nil?
    ExportContainer[@command_name] = base
  else
    raise(
      Errors::ExecutorDidMountEarly,
      "The component for command name: `#{@command_name}`" \
      ' was mounted early. Avoid duplication naming within commands.'
    )
  end
end