class Flo::CommandCollection

A collection of commands. Behaves like a Hash, except that fetching a key that does not exist raises an error

Public Class Methods

new() click to toggle source
# File lib/flo/command_collection.rb, line 19
def initialize
  @commands = {}
end

Public Instance Methods

[](key) click to toggle source

Returns the value corresponding to the key. Identical to accessing Hash values, except that fetching a value that does not exist raises an error @param key [String] Name of the command @raises Flo::CommandNotDefinedError if the command does not exist

# File lib/flo/command_collection.rb, line 28
def [](key)
  raise CommandNotDefinedError.new("#{key} command is not defined") unless @commands.has_key?(key)
  @commands[key]
end