Module: Alias::Console

Defined in:
lib/alias/console.rb

Overview

This module contains the main methods to be accessed from a ruby shell i.e. irb. Simply extend Alias::Console in your ruby shell.

Instance Method Summary collapse

Instance Method Details

#create_aliases(*args) ⇒ Object

See Alias::Manager.create_aliases for usage.



5
6
7
# File 'lib/alias/console.rb', line 5

def create_aliases(*args)
  Alias.manager.console_create_aliases(*args)
end

#save_aliases(file = nil) ⇒ Object

Saves aliases to a file. If no file is given, defaults to config/alias.yml if the config directory exists (for Rails). Otherwise defaults to ~/.alias.yml.



11
12
13
# File 'lib/alias/console.rb', line 11

def save_aliases(file=nil)
  Alias.manager.save_aliases(file)
end

#search_aliases(*args) ⇒ Object

Searches aliases with a search term as defined by Alias::Manager.search. If no arguments given, all aliases are listed.



16
17
18
# File 'lib/alias/console.rb', line 16

def search_aliases(*args)
  args.empty? ? Alias.manager.all_aliases : Alias.manager.search(*args)
end