Class: Democritus::ClassBuilder::Command

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/democritus/class_builder/command.rb

Overview

An abstract class useful in composing additional Democritus::Commands

The expected interface for a Democritus::Command is as follows:

  • Its #initialize method must accept a :builder keyword (i.e. ‘#initialize`)

  • It responds to #call and #call does not accept any parameters

Instance Method Summary collapse

Constructor Details

#initialize(builder:) ⇒ Command

Returns a new instance of Command.

Parameters:



17
18
19
# File 'lib/democritus/class_builder/command.rb', line 17

def initialize(*, builder:)
  self.builder = builder
end

Instance Method Details

#callObject

This method is abstract.

Subclass and override #call to implement

Responsible for applying changes to the class that is being built.

Returns:

  • void



27
28
29
# File 'lib/democritus/class_builder/command.rb', line 27

def call
  fail(NotImplementedError, 'Method #call should be overriden in child classes')
end