Class: AbstractMapper::Commands Private
- Inherits:
-
Object
- Object
- AbstractMapper::Commands
- Defined in:
- lib/abstract_mapper/commands.rb,
lib/abstract_mapper/commands/base.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
Defined Under Namespace
Classes: Base
Class Method Summary collapse
-
.<<(other) ⇒ undefined
private
Returns a new immutable registry with added command name and type.
-
.[](name) ⇒ AbstractMapper::Commands::Base
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
33 34 35 36 |
# File 'lib/abstract_mapper/commands.rb', line 33 def <<(other) command = Base.new(*other) self.class.new @registry.merge(command.name => command) end |
.[](name) ⇒ AbstractMapper::Commands::Base
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
47 48 49 |
# File 'lib/abstract_mapper/commands.rb', line 47 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.
22 23 24 25 |
# File 'lib/abstract_mapper/commands.rb', line 22 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 13
|