Class: Zae::Permission
- Inherits:
-
Object
- Object
- Zae::Permission
- Defined in:
- lib/zae/permission.rb
Overview
define how command should be run, either to become super user or not.
Constant Summary collapse
- BECOMERS =
[Pathname.new('/usr/bin/sudo'), Pathname.new('/usr/bin/doas')].freeze
Instance Method Summary collapse
-
#becomer ⇒ Object
find becomer program to use in system.
-
#initialize(action, configuration) ⇒ Permission
constructor
A new instance of Permission.
-
#super? ⇒ Boolean
needs to be super user to run?.
Constructor Details
#initialize(action, configuration) ⇒ Permission
Returns a new instance of Permission.
23 24 25 26 |
# File 'lib/zae/permission.rb', line 23 def initialize(action, configuration) @action = action @configuration = configuration end |
Instance Method Details
#becomer ⇒ Object
find becomer program to use in system
34 35 36 |
# File 'lib/zae/permission.rb', line 34 def becomer BECOMERS.first { |exe| return exe if exe.exist? } end |
#super? ⇒ Boolean
needs to be super user to run?
29 30 31 |
# File 'lib/zae/permission.rb', line 29 def super? @configuration[:super].key?(@action) end |