class Hanami::CLI::CommandRegistry::Node
Node
of the registry
@since 0.1.0 @api private
Attributes
after_callbacks[R]
@since 0.1.0 @api private
aliases[R]
@since 0.1.0 @api private
before_callbacks[R]
@since 0.1.0 @api private
children[R]
@since 0.1.0 @api private
command[R]
@since 0.1.0 @api private
parent[R]
@since 0.1.0 @api private
Public Class Methods
new(parent = nil)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 110 def initialize(parent = nil) @parent = parent @children = Concurrent::Hash.new @aliases = Concurrent::Hash.new @command = nil @before_callbacks = Utils::Callbacks::Chain.new @after_callbacks = Utils::Callbacks::Chain.new end
Public Instance Methods
alias!(key, child)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 140 def alias!(key, child) @aliases[key] = child end
aliases!(aliases)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 146 def aliases!(aliases) aliases.each do |a| parent.alias!(a, self) end end
leaf!(command)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 134 def leaf!(command) @command = command end
leaf?()
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 154 def leaf? !command.nil? end
lookup(token)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 128 def lookup(token) children[token] || aliases[token] end
put(parent, key)
click to toggle source
@since 0.1.0 @api private
# File lib/hanami/cli/command_registry.rb, line 122 def put(parent, key) children[key] ||= self.class.new(parent) end