Class: Zoom::Profile::Ack

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

Instance Attribute Summary

Attributes inherited from Zoom::Profile

#format_flags, #pattern, #taggable

Instance Method Summary collapse

Methods inherited from Zoom::Profile

#after, #before, #class_name, #exe, #flags, from_json, #go, #name, #operator, #preprocess, profile_by_name, subclasses, #to_s

Constructor Details

#initialize(n = nil, o = nil, f = nil, b = nil, a = nil) ⇒ Ack

Returns a new instance of Ack.



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

def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
    # Special case because of debian
    o ||= "ack"
    if ((o == "ack") && ScoobyDoo.where_are_you("ack-grep"))
        o = "ack-grep"
    end

    f ||= "--smart-case"
    super(n, o, f, b, a)
    @format_flags = [
        "--follow",
        "-H",
        "--nobreak",
        "--nocolor",
        "--noheading",
        "-s"
    ].join(" ")
    @taggable = true
end

Instance Method Details

#translate(from) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zoom/profile/ack.rb', line 22

def translate(from)
    to = Array.new
    from.each do |flag, value|
        case flag
        when "ignore"
            value.each do |v|
                to.push("--ignore-dir=\"#{v}\"")
                to.push("--ignore-file=\"match:/#{v}/\"")
            end
        when "word-regexp"
            to.push("-w")
        end
    end
    return to.join(" ")
end