Skip to content

Commit

Permalink
Remove SetMethods mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis Marshall committed Sep 4, 2012
1 parent c61754b commit 32fc02d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 36 deletions.
28 changes: 23 additions & 5 deletions lib/cap2/process.rb
@@ -1,17 +1,31 @@
require 'cap2/set_methods'

module Cap2
# A class with methods for querying capabilities for the
# A class with methods for managing capabilities for the
# process with pid provided to the initialize method.
class Process
include SetMethods

# Initialize a new Process object for the given pid.
def initialize(pid)
@pid = pid
@caps = getcaps
end

# Returns whether the given capability is permitted
def permitted?(capability)
reload
@caps[:permitted].include? capability
end

# Returns whether the given capability is effective
def effective?(capability)
reload
@caps[:effective].include? capability
end

# Returns whether the given capability is inheritable
def inheritable?(capability)
reload
@caps[:inheritable].include? capability
end

# Enable the given capability for this process.
def enable(capability)
check_pid
Expand All @@ -34,5 +48,9 @@ def check_pid
raise 'Cannot modify capabilities of other processes'
end
end

def reload
@caps = getcaps
end
end
end
31 changes: 0 additions & 31 deletions lib/cap2/set_methods.rb

This file was deleted.

0 comments on commit 32fc02d

Please sign in to comment.