Class: Zoom::Profile::Pt

Inherits:
Zoom::Profile show all
Defined in:
lib/zoom/profile/pt.rb

Instance Attribute Summary

Attributes inherited from Zoom::Profile

#immutable, #taggable

Instance Method Summary collapse

Methods inherited from Zoom::Profile

#append, #colors, #flags, from_json, #info, #operator, #prepend, profile_by_name, #to_s

Constructor Details

#initialize(operator = nil, flags = "--color -Se", envprepend = "", append = "") ⇒ Pt

Returns a new instance of Pt.



21
22
23
24
25
26
27
28
29
# File 'lib/zoom/profile/pt.rb', line 21

def initialize(
    operator = nil,
    flags = "--color -Se",
    envprepend = "",
    append = ""
)
    super("pt", flags, envprepend, append)
    @taggable = true
end

Instance Method Details

#exe(args, pattern) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zoom/profile/pt.rb', line 5

def exe(args, pattern)
    # Emulate ag/ack as much as possible
    if (pattern.nil? || pattern.empty?)
        system(
            "#{self.to_s} #{args} #{self.append} | " \
            "sed \"s|\\[K[:-]|\\[K\\n|\" | #{@pager}"
        )
    else
        system(
            "#{self.to_s} #{args} #{pattern.shellescape} " \
            "#{self.append} | sed \"s|\\[K[:-]|\\[K\\n|\" | " \
            "#{@pager}"
        )
    end
end