class Aka::Shortcut

Attributes

command[RW]
description[RW]
function[RW]
shortcut[RW]
tag[RW]

Public Class Methods

generate_output(row) click to toggle source
# File lib/aka/shortcut.rb, line 13
    def self.generate_output(row)
      string = if row.function
        <<-EOS.gsub(/^        /, '')
        function #{row.shortcut} {
          #{row.command}
        }
        EOS
      else
        %{alias #{row.shortcut}="#{row.command.gsub(%{"}, %{\\"})}"}
      end

      string
    end
parse(options) click to toggle source
# File lib/aka/shortcut.rb, line 3
def self.parse(options)
  self.new.tap do |row|
    row.shortcut = options['shortcut']
    row.command = options['command']
    row.tag = options['tag'] if options['tag']
    row.description = options['description'] if options['description']
    row.function = options['function'] if options['function']
  end
end

Public Instance Methods

to_hash() click to toggle source
# File lib/aka/shortcut.rb, line 33
def to_hash
  {
    :shortcut => self.shortcut,
    :command => self.command,
    :tag => self.tag,
    :description => self.description,
    :function => self.function
  }
end