Class: AckProfile
- Inherits:
-
ZoomProfile
- Object
- Hash
- ZoomProfile
- AckProfile
- Defined in:
- lib/ack_profile.rb
Instance Attribute Summary
Attributes inherited from ZoomProfile
Instance Method Summary collapse
- #colors ⇒ Object
- #exe(args, pattern) ⇒ Object
-
#initialize(operator = nil, flags = "--smart-case", envprepend = "", append = "") ⇒ AckProfile
constructor
A new instance of AckProfile.
Methods inherited from ZoomProfile
#append, #flags, from_json, #info, #operator, #prepend, #to_s
Constructor Details
#initialize(operator = nil, flags = "--smart-case", envprepend = "", append = "") ⇒ AckProfile
Returns a new instance of AckProfile.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ack_profile.rb', line 23 def initialize( operator = nil, flags = "--smart-case", envprepend = "", append = "" ) # Special case because of debian operator = nil if (ScoobyDoo.where_are_you("ack")) operator = "ack" elsif (ScoobyDoo.where_are_you("ack-grep")) operator = "ack-grep" else # Oops operator = "echo" if (operator == "echo") flags = "#" envprepend = "" append = "" end end super(operator, flags, envprepend, append) @taggable = true end |
Instance Method Details
#colors ⇒ Object
5 6 7 |
# File 'lib/ack_profile.rb', line 5 def colors 'ACK_COLOR_LINENO=white ACK_COLOR_MATCH="black on_white"' end |
#exe(args, pattern) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ack_profile.rb', line 9 def exe(args, pattern) if (pattern.nil? || pattern.empty?) system( "#{self.to_s} --pager \"#{@pager}\" #{args} " \ "#{self.append}" ) else system( "#{self.to_s} --pager \"#{@pager}\" #{args} " \ "#{pattern.shellescape} #{self.append}" ) end end |