class Bookmark::Bookmark
Public Class Methods
new(options)
click to toggle source
# File lib/bookmark.rb, line 6 def initialize(options) @name = options[:name] @command = options[:command] @path = options[:path] @alias = "alias #{@name}='cd #{@path}" @alias << " && #{@command}" if @command @alias << "'" end
shell_rc()
click to toggle source
# File lib/bookmark.rb, line 24 def self.shell_rc File.join(ENV['HOME'], ".#{File.basename(ENV['SHELL'])}rc") end
Public Instance Methods
save!()
click to toggle source
# File lib/bookmark.rb, line 15 def save! File.open(Bookmark.shell_rc, 'a') do |file| file.puts @alias end puts "Bookmark #{@name} saved! Run" puts "source #{Bookmark.shell_rc}" puts "to start using it." end