class Zoom::Profile::Ag

Public Class Methods

new(n = nil, t = nil, f = nil, b = nil, a = nil) click to toggle source
Calls superclass method Zoom::Profile::new
# File lib/zoom/profile/ag.rb, line 16
def initialize(n = nil, t = nil, f = nil, b = nil, a = nil)
    f ||= "-S"
    t ||= "ag"
    super(n, t, f, b, a)
end

Public Instance Methods

grep_like_format_flags(all = false) click to toggle source
Calls superclass method Zoom::Profile#grep_like_format_flags
# File lib/zoom/profile/ag.rb, line 2
def grep_like_format_flags(all = false)
    super
    @format_flags = [
        "--filename",
        "--nobreak",
        "--nocolor",
        "--noheading",
        "--numbers",
        "--silent"
    ].join(" ")
    @format_flags = "#{@format_flags} -u" if (all)
    @taggable = true
end
only_exts_and_files() click to toggle source
# File lib/zoom/profile/ag.rb, line 22
def only_exts_and_files
    if (!@exts.empty? || !@files.empty?)
        return "-G \"\.(#{@exts.join("|")})$|#{@files.join("|")}\""
    end
    return ""
end
translate(from) click to toggle source
# File lib/zoom/profile/ag.rb, line 29
def translate(from)
    to = Array.new
    from.each do |flag, value|
        case flag
        when "all"
            grep_like_format_flags(true)
        when "follow"
            to.push("--follow")
        when "ignore"
            value.each do |v|
                to.push("--ignore=#{v}")
            end
        when "word-regexp"
            to.push("-w")
        end
    end
    return to.join(" ")
end