Class: AgentJail::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_jail/configuration.rb

Constant Summary collapse

VALID_ON_UNSUPPORTED =
%i[warn raise ignore].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
# File 'lib/agent_jail/configuration.rb', line 9

def initialize
  @default_timeout = 30
  @default_memory_mb = 512
  @default_fs_allow = []
  @on_unsupported = :warn
end

Instance Attribute Details

#default_fs_allowObject

Returns the value of attribute default_fs_allow.



7
8
9
# File 'lib/agent_jail/configuration.rb', line 7

def default_fs_allow
  @default_fs_allow
end

#default_memory_mbObject

Returns the value of attribute default_memory_mb.



7
8
9
# File 'lib/agent_jail/configuration.rb', line 7

def default_memory_mb
  @default_memory_mb
end

#default_timeoutObject

Returns the value of attribute default_timeout.



7
8
9
# File 'lib/agent_jail/configuration.rb', line 7

def default_timeout
  @default_timeout
end

#on_unsupportedObject

Returns the value of attribute on_unsupported.



7
8
9
# File 'lib/agent_jail/configuration.rb', line 7

def on_unsupported
  @on_unsupported
end

Instance Method Details

#validate!Object

Raises:

  • (ArgumentError)


16
17
18
19
20
21
# File 'lib/agent_jail/configuration.rb', line 16

def validate!
  return if VALID_ON_UNSUPPORTED.include?(@on_unsupported)

  raise ArgumentError,
        "on_unsupported must be one of #{VALID_ON_UNSUPPORTED.inspect}, got #{@on_unsupported.inspect}"
end