Class: Zoom::ProfileManager

Inherits:
Object
  • Object
show all
Defined in:
lib/zoom/profile_manager.rb

Constant Summary collapse

@@ranking =
[
    ["ag", "Zoom::Profile::Ag", "-Su"],
    ["pt", "Zoom::Profile::Pt", "-SU --hidden"],
    ["ack", "Zoom::Profile::Ack", ""],
    ["ack-grep", "Zoom::Profile::Ack", ""],
    ["grep", "Zoom::Profile::Grep", "-ai"],
    ["find", "Zoom::Profile::Find", ""]
]

Class Method Summary collapse

Class Method Details

.default_profile ⇒ Object



22
23
24
25
26
27
# File 'lib/zoom/profile_manager.rb', line 22

def self.default_profile
    @@ranking.each do |op, clas, all|
        return op if (ScoobyDoo.where_are_you(op))
    end
    return nil # shouldn't happen
end

.default_profiles ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/zoom/profile_manager.rb', line 29

def self.default_profiles
    profiles = Hash.new

    @@ranking.each do |op, clas, all|
        if (ScoobyDoo.where_are_you(op))
            name = op.gsub("-grep", "")
            obj = Zoom::Profile.profile_by_name(clas)
            profiles[name] = obj.new(name)
            if (!all.empty?)
                profiles["all"] ||= obj.new("all", name, all)
            end
        end
    end

    profiles["passwords"] = Zoom::Profile::Passwords.new(
        "passwords"
    )

    return profiles
end