Method: Inspec::Resources::Crontab#initialize
- Defined in:
- lib/inspec/resources/crontab.rb
#initialize(opts = nil) ⇒ Crontab
Returns a new instance of Crontab.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/inspec/resources/crontab.rb', line 37 def initialize(opts = nil) if opts.respond_to?(:fetch) Hash[opts.map { |k, v| [k.to_sym, v] }] @user = opts.fetch(:user, nil) @path = opts.fetch(:path, nil) raise Inspec::Exceptions::ResourceFailed, "A user or path must be supplied." if @user.nil? && @path.nil? raise Inspec::Exceptions::ResourceFailed, "Either user or path must be supplied, not both!" if !@user.nil? && !@path.nil? else @user = opts @path = nil end @params = read_crontab end |