Class: Serega::SeregaPlugins::DepthLimit::DepthLimitConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/depth_limit/depth_limit.rb

Overview

DepthLimit config object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ SeregaPlugins::DepthLimit::DepthLimitConfig

Initializes DepthLimitConfig object

Parameters:

  • opts (Hash)

    depth_limit plugin options



101
102
103
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 101

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



92
93
94
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 92

def opts
  @opts
end

Instance Method Details

#limitInteger

Returns defined depth limit.

Returns:

  • (Integer)

    defined depth limit



106
107
108
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 106

def limit
  opts.fetch(:limit)
end

#limit=(value) ⇒ Integer

Set depth limit

Parameters:

  • value (Integer)

    depth limit

Returns:

  • (Integer)

    depth limit

Raises:



116
117
118
119
120
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 116

def limit=(value)
  raise SeregaError, "Depth limit must be an Integer" unless value.is_a?(Integer)

  opts[:limit] = value
end