Class: Zoom::Profile::Ag
- Inherits:
-
Zoom::Profile
- Object
- Hash
- Zoom::Profile
- Zoom::Profile::Ag
- Defined in:
- lib/zoom/profile/ag.rb
Instance Attribute Summary
Attributes inherited from Zoom::Profile
#exts, #files, #format_flags, #regex, #taggable
Instance Method Summary collapse
- #grep_like_format_flags(all = false) ⇒ Object
-
#initialize(n = nil, t = nil, f = nil, b = nil, a = nil) ⇒ Ag
constructor
A new instance of Ag.
- #only_exts_and_files ⇒ Object
- #translate(from) ⇒ Object
Methods inherited from Zoom::Profile
#after, #before, #class_name, #exe, #flags, from_json, #grep_like_tags?, #name, #preprocess, profile_by_name, subclasses, #to_s, #tool
Constructor Details
#initialize(n = nil, t = nil, f = nil, b = nil, a = nil) ⇒ Ag
Returns a new instance of Ag.
16 17 18 19 20 |
# 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 |
Instance Method Details
#grep_like_format_flags(all = false) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# 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 ⇒ Object
22 23 24 25 26 27 |
# 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) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# 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 |