Class: AgProfile

Inherits:
ZoomProfile show all
Defined in:
lib/ag_profile.rb

Instance Attribute Summary

Attributes inherited from ZoomProfile

#taggable

Instance Method Summary collapse

Methods inherited from ZoomProfile

#append, #flags, from_json, #info, #operator, #prepend

Constructor Details

#initialize(operator = nil, flags = "-S", envprepend = "", append = "") ⇒ AgProfile

Returns a new instance of AgProfile.



23
24
25
26
27
28
29
30
31
# File 'lib/ag_profile.rb', line 23

def initialize(
    operator = nil,
    flags = "-S",
    envprepend = "",
    append = ""
)
    super("ag", flags, envprepend, append)
    @taggable = true
end

Instance Method Details

#colorsObject



5
6
7
# File 'lib/ag_profile.rb', line 5

def colors
    '--color-match "47;1;30" --color-line-number "0;37"'
end

#exe(args, pattern) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ag_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

#to_sObject



33
34
35
36
37
38
39
40
# File 'lib/ag_profile.rb', line 33

def to_s
    [
        self["prepend"],
        self["operator"],
        self.colors,
        self["flags"]
    ].join(" ").strip
end