class Kamaze::Project::Tools::BaseTool

Provides base for tools

@abstract

Public Class Methods

new() click to toggle source
# File lib/kamaze/project/tools/base_tool.rb, line 15
def initialize
  super()

  dispatch_event(:before_setup)
  setup
  dispatch_event(:after_setup)

  attrs_mute!
end

Public Instance Methods

mutable_attributes() click to toggle source

Mutable attributes

Mutable attributes become “ro“ after initialization

@return [Array] @abstract

# File lib/kamaze/project/tools/base_tool.rb, line 31
def mutable_attributes
  []
end

Protected Instance Methods

attrs_mute!() click to toggle source

Mut(at)e attributes

After initialization, attributes given has mutable become “ro“ (protected setter)

@return [self]

# File lib/kamaze/project/tools/base_tool.rb, line 50
def attrs_mute!
  mutable_attributes.each do |m|
    # rubocop:disable Style/AccessModifierDeclarations
    self.singleton_class.class_eval { protected "#{m}=" }
    # rubocop:enable Style/AccessModifierDeclarations
  end

  self
end
setup() click to toggle source

Execute additionnal setup

@abstract

# File lib/kamaze/project/tools/base_tool.rb, line 40
def setup
  nil
end