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



83
84
85
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 83

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



74
75
76
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 74

def opts
  @opts
end

Instance Method Details

#limitInteger

Returns defined depth limit.

Returns:

  • (Integer)

    defined depth limit



88
89
90
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 88

def limit
  opts.fetch(:limit)
end

#limit=(value) ⇒ Integer

Set depth limit

Parameters:

  • value (Integer)

    depth limit

Returns:

  • (Integer)

    depth limit

Raises:



98
99
100
101
102
# File 'lib/serega/plugins/depth_limit/depth_limit.rb', line 98

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

  opts[:limit] = value
end