Class: AbstractMapper::Commands Private
- Inherits:
-
Object
- Object
- AbstractMapper::Commands
- Defined in:
- lib/abstract_mapper/commands.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Collection of DSL commands used by the builder
Class Method Summary collapse
-
.<<(other) ⇒ undefined
private
Returns a new immutable registry with added command name and type.
-
.[](name) ⇒ AbstractMapper::Command
private
Returns the registered command by name.
- .initialize(registry = {}) ⇒ Object private
-
.new(registry = {}) ⇒ Faceter::Commands
Creates an immutable collection of commands.
Class Method Details
.<<(other) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new immutable registry with added command name and type
31 32 33 34 |
# File 'lib/abstract_mapper/commands.rb', line 31 def <<(other) command = Command.new(*other) self.class.new @registry.merge(command.name => command) end |
.[](name) ⇒ AbstractMapper::Command
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the registered command by name
45 46 47 |
# File 'lib/abstract_mapper/commands.rb', line 45 def [](name) @registry.fetch(name.to_sym) { fail(Errors::UnknownCommand.new name) } end |
.initialize(registry = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 |
# File 'lib/abstract_mapper/commands.rb', line 20 def initialize(registry = {}) @registry = registry.dup IceNine.deep_freeze(self) end |
.new(registry = {}) ⇒ Faceter::Commands
Creates an immutable collection of commands
|
# File 'lib/abstract_mapper/commands.rb', line 11
|