Class: NCPP::CommandRegistry

Inherits:
Hash
  • Object
show all
Defined in:
lib/ncpp/commands.rb

Constant Summary

Constants inherited from Hash

Hash::KEY_SUGGEST_JARO_WEIGHT, Hash::KEY_SUGGEST_LEVENSHTEIN_WEIGHT, Hash::KEY_SUGGEST_THRESH

Instance Method Summary collapse

Methods inherited from Hash

#suggest_similar_key

Constructor Details

#initialize(commands, aliases: {}) ⇒ CommandRegistry

Returns a new instance of CommandRegistry.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ncpp/commands.rb', line 11

def initialize(commands, aliases: {})
  @aliases = aliases
  h = commands.dup

  aliases.each do |alias_name, target|
    h[alias_name] = h[target]
  end

  super()
  merge!(h)
end