Class/Module Index [+]

Quicksearch

Compass::Commands::Registry

Public Instance Methods

[](name) click to toggle source
Alias for: get
[]=(name, command_class) click to toggle source
Alias for: register
abbreviation?(name) click to toggle source
# File lib/compass/commands/registry.rb, line 25
def abbreviation?(name)
  re = /^#{Regexp.escape(name)}/
  @commands.keys.detect{|k| k.to_s =~ re}
end
abbreviation_of(name) click to toggle source
# File lib/compass/commands/registry.rb, line 12
def abbreviation_of(name)
  re = /^#{Regexp.escape(name)}/
  matching = @commands.keys.select{|k| k.to_s =~ re}
  if matching.size == 1
    matching.first
  elsif name =~ /^-/
    nil
  elsif matching.size > 1
    raise Compass::Error, "Ambiguous abbreviation '#{name}'. Did you mean one of: #{matching.join(", ")}"
  else
    raise Compass::Error, "Command not found: #{name}"
  end
end
all() click to toggle source
# File lib/compass/commands/registry.rb, line 33
def all
  @commands.keys
end
command_exists?(name) click to toggle source
# File lib/compass/commands/registry.rb, line 29
def command_exists?(name)
  @commands ||= Hash.new
  name && (@commands.has_key?(name.to_sym) || abbreviation?(name))
end
get(name) click to toggle source
# File lib/compass/commands/registry.rb, line 7
def get(name)
  return unless name
  @commands ||= Hash.new
  @commands[name.to_sym] || @commands[abbreviation_of(name)]
end
Also aliased as: []
register(name, command_class) click to toggle source
# File lib/compass/commands/registry.rb, line 3
def register(name, command_class)
  @commands ||= Hash.new
  @commands[name.to_sym] = command_class
end
Also aliased as: []=

[Validate]

Generated with the Darkfish Rdoc Generator 2.