Sha256: 19166a55b90f4ca13957cdb0fbe4a2c01c4b4890b109f564372e2c1d6dc9103e
Contents?: true
Size: 872 Bytes
Versions: 26
Compression:
Stored size: 872 Bytes
Contents
class Ppl::Application::Router attr_accessor :aliases attr_accessor :default attr_accessor :external_command def initialize(command_suite) @command_suite = command_suite @aliases = {} end def route(argument) command = @command_suite.find_command(argument) if command.nil? && @aliases.has_key?(argument) if is_bang_alias?(argument) command = create_external_command(argument) else command = @command_suite.find_command(@aliases[argument]) end end if command.nil? && !@default.nil? command = @command_suite.find_command(@default) end return command end private def is_bang_alias?(key) @aliases[key].match(/^!/) end def create_external_command(key) @external_command.name = key @external_command.command = @aliases[key][1..-1] @external_command end end
Version data entries
26 entries across 26 versions & 1 rubygems