Class: Aka::Shortcut
- Inherits:
-
Object
- Object
- Aka::Shortcut
- Defined in:
- lib/aka/shortcut.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#description ⇒ Object
Returns the value of attribute description.
-
#function ⇒ Object
Returns the value of attribute function.
-
#shortcut ⇒ Object
Returns the value of attribute shortcut.
-
#tag ⇒ Object
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
28 29 30 |
# File 'lib/aka/shortcut.rb', line 28 def command @command end |
#description ⇒ Object
Returns the value of attribute description.
30 31 32 |
# File 'lib/aka/shortcut.rb', line 30 def description @description end |
#function ⇒ Object
Returns the value of attribute function.
31 32 33 |
# File 'lib/aka/shortcut.rb', line 31 def function @function end |
#shortcut ⇒ Object
Returns the value of attribute shortcut.
27 28 29 |
# File 'lib/aka/shortcut.rb', line 27 def shortcut @shortcut end |
#tag ⇒ Object
Returns the value of attribute tag.
29 30 31 |
# File 'lib/aka/shortcut.rb', line 29 def tag @tag end |
Class Method Details
.generate_output(row) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aka/shortcut.rb', line 13 def self.generate_output(row) string = if row.function " function \#{row.shortcut} {\n \#{row.command}\n }\n EOS\n else\n %{alias \#{row.shortcut}=\"\#{row.command.gsub(%{\"}, %{\\\\\"})}\"}\n end\n\n string\nend\n".gsub(/^ /, '') |
.parse(options) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/aka/shortcut.rb', line 3 def self.parse() self.new.tap do |row| row.shortcut = ['shortcut'] row.command = ['command'] row.tag = ['tag'] if ['tag'] row.description = ['description'] if ['description'] row.function = ['function'] if ['function'] end end |
Instance Method Details
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 41 |
# 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 |