class Zoom::ProfileManager

Public Class Methods

class_by_tool(t) click to toggle source
# File lib/zoom/profile_manager.rb, line 16
def self.class_by_tool(t)
    found = @@ranking.select do |tool, clas|
        t == tool
    end
    return found[0][1] if (!found.empty?)
    return nil
end
default_class() click to toggle source
# File lib/zoom/profile_manager.rb, line 24
def self.default_class
    if (@@tool && ScoobyDoo.where_are_you(@@tool))
        return class_by_tool(@@tool)
    end

    @@ranking.each do |tool, clas|
        return clas if (ScoobyDoo.where_are_you(tool))
    end

    return nil # shouldn't happen
end
default_profiles() click to toggle source
# File lib/zoom/profile_manager.rb, line 36
def self.default_profiles
    profiles = Hash.new

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

    Zoom::Profile.subclasses.each do |clas|
        case clas.to_s
        when /^Zoom::SecurityProfile.*/
            # Ignore these
        when /^Zoom::Profile::(Ag|Ack|Find|Grep|Pt|Rg)/
            # Ignore these
        else
            # Custom classes
            c = clas.new
            profiles[c.name] = c
        end
    end

    return profiles
end
default_tool() click to toggle source
# File lib/zoom/profile_manager.rb, line 63
def self.default_tool
    if (@@tool && ScoobyDoo.where_are_you(@@tool))
        return @@tool
    end

    @@ranking.each do |tool, clas|
        return tool if (ScoobyDoo.where_are_you(tool))
    end

    return nil # shouldn't happen
end
force_tool(tool = nil) click to toggle source
# File lib/zoom/profile_manager.rb, line 75
def self.force_tool(tool = nil)
    if (tool == "ack")
        tool = "ack-grep" if (ScoobyDoo.where_are_you("ack-grep"))
    end

    tool = nil if (tool && !ScoobyDoo.where_are_you(tool))

    @@tool = tool
end
security_profiles() click to toggle source
# File lib/zoom/profile_manager.rb, line 85
def self.security_profiles
    profiles = Array.new
    Zoom::SecurityProfile.subclasses.each do |clas|
        profiles.push(clas.new)
    end
    return profiles
end