Class: PasswordsProfile

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

Instance Attribute Summary

Attributes inherited from ZoomProfile

#taggable

Instance Method Summary collapse

Methods inherited from ZoomProfile

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

Constructor Details

#initialize(operator = nil, flags = "", envprepend = "", append = "") ⇒ PasswordsProfile

Returns a new instance of PasswordsProfile.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/passwords_profile.rb', line 26

def initialize(
    operator = nil,
    flags = "",
    envprepend = "",
    append = ""
)
    @passwd_regex = "\"pass(word|wd)?[^:=,>]? *[:=,>]\""

    if (ScoobyDoo.where_are_you("ag"))
        @profile = AgProfile.new(nil, "-uS", "", @passwd_regex)
    elsif (
        ScoobyDoo.where_are_you("ack") ||
        ScoobyDoo.where_are_you("ack-grep")
    )
        @profile = AckProfile.new(
            nil,
            "--smart-case",
            "",
            @passwd_regex
        )
    else
        @profile = GrepProfile.new(
            nil,
            "--color=always -EHinR",
            "",
            @passwd_regex
        )
    end

    super(
        @profile.operator,
        @profile.flags,
        @profile.prepend,
        @profile.append
    )
    @taggable = true
end

Instance Method Details

#colorsObject



8
9
10
# File 'lib/passwords_profile.rb', line 8

def colors
    return @profile.colors
end

#exe(args, pattern) ⇒ Object



12
13
14
# File 'lib/passwords_profile.rb', line 12

def exe(args, pattern)
    @profile.exe(args, pattern)
end

#infoObject



16
17
18
19
20
21
22
23
24
# File 'lib/passwords_profile.rb', line 16

def info
    [
        "Class   : #{self.class.to_s}",
        "Prepend : #{@profile.prepend}",
        "Operator: #{@profile.operator}",
        "Flags   : #{@profile.flags}",
        "Append  : #{@profile.append}"
    ].join("\n").strip
end

#to_sObject



64
65
66
# File 'lib/passwords_profile.rb', line 64

def to_s
    return @porfile.to_s
end