Class: Democritus::ClassBuilder::Command
- Inherits:
-
Object
- Object
- Democritus::ClassBuilder::Command
- 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
Direct Known Subclasses
Democritus::ClassBuilder::Commands::Attribute, Democritus::ClassBuilder::Commands::Attributes
Instance Method Summary collapse
-
#call ⇒ Object
abstract
Responsible for applying changes to the class that is being built.
-
#initialize(builder:) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(builder:) ⇒ Command
Returns a new instance of Command.
17 18 19 |
# File 'lib/democritus/class_builder/command.rb', line 17 def initialize(*, builder:) self.builder = builder end |
Instance Method Details
#call ⇒ Object
This method is abstract.
Subclass and override #call to implement
Responsible for applying changes to the class that is being built.
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 |