Class: AliasManager::Alias
- Inherits:
-
Struct
- Object
- Struct
- AliasManager::Alias
- Defined in:
- lib/alias_manager/alias.rb
Instance Attribute Summary collapse
-
#string ⇒ Object
Returns the value of attribute string.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#string ⇒ Object
Returns the value of attribute string
2 3 4 |
# File 'lib/alias_manager/alias.rb', line 2 def string @string end |
Class Method Details
.all ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/alias_manager/alias.rb', line 4 def self.all @all ||= `echo "source #{ENV['HOME']}/.zshrc; alias -L" | /bin/zsh`.split("\n").select do |alias_line| alias_line[/alias\s+[^=]*=/] end.map do |string| new(string) end end |
Instance Method Details
#abbreviation ⇒ Object
12 13 14 |
# File 'lib/alias_manager/alias.rb', line 12 def abbreviation string.match(/alias\s+([^=]*)=/)[1] end |
#command ⇒ Object
16 17 18 |
# File 'lib/alias_manager/alias.rb', line 16 def command string.match(/='?"?([^'"]*)'?"?/)[1] end |