Method: Inspec::Resources::Crontab#initialize

Defined in:
lib/resources/crontab.rb

#initialize(opts = nil) ⇒ Crontab



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/resources/crontab.rb', line 38

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?
  else
    @user = opts
    @path = nil
  end
  @params = read_crontab
end