Module: Serega::SeregaConfig::SeregaConfigInstanceMethods

Included in:
Serega::SeregaConfig
Defined in:
lib/serega/config.rb

Overview

:nocov:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



24
25
26
# File 'lib/serega/config.rb', line 24

def opts
  @opts
end

Instance Method Details

#attribute_keysObject



44
45
46
# File 'lib/serega/config.rb', line 44

def attribute_keys
  opts.fetch(:attribute_keys)
end

#check_initiate_paramsObject



52
53
54
# File 'lib/serega/config.rb', line 52

def check_initiate_params
  opts.fetch(:check_initiate_params)
end

#check_initiate_params=(value) ⇒ Object

Raises:



56
57
58
59
# File 'lib/serega/config.rb', line 56

def check_initiate_params=(value)
  raise SeregaError, "Must have boolean value, #{value.inspect} provided" if (value != true) && (value != false)
  opts[:check_initiate_params] = value
end

#from_jsonObject



78
79
80
# File 'lib/serega/config.rb', line 78

def from_json
  opts.fetch(:from_json)
end

#from_json=(value) ⇒ Object



82
83
84
# File 'lib/serega/config.rb', line 82

def from_json=(value)
  opts[:from_json] = value
end

#initialize(opts = nil) ⇒ Object

Initializes new config instance.

Parameters:

  • opts (Hash) (defaults to: nil)

    Initial config options



31
32
33
34
# File 'lib/serega/config.rb', line 31

def initialize(opts = nil)
  opts ||= DEFAULTS
  @opts = SeregaUtils::EnumDeepDup.call(opts)
end

#initiate_keysObject



40
41
42
# File 'lib/serega/config.rb', line 40

def initiate_keys
  opts.fetch(:initiate_keys)
end

#max_cached_map_per_serializer_countObject



61
62
63
# File 'lib/serega/config.rb', line 61

def max_cached_map_per_serializer_count
  opts.fetch(:max_cached_map_per_serializer_count)
end

#max_cached_map_per_serializer_count=(value) ⇒ Object

Raises:



65
66
67
68
# File 'lib/serega/config.rb', line 65

def max_cached_map_per_serializer_count=(value)
  raise SeregaError, "Must have Integer value, #{value.inspect} provided" unless value.is_a?(Integer)
  opts[:max_cached_map_per_serializer_count] = value
end

#pluginsObject



36
37
38
# File 'lib/serega/config.rb', line 36

def plugins
  opts.fetch(:plugins)
end

#serialize_keysObject



48
49
50
# File 'lib/serega/config.rb', line 48

def serialize_keys
  opts.fetch(:serialize_keys)
end

#to_jsonObject



70
71
72
# File 'lib/serega/config.rb', line 70

def to_json
  opts.fetch(:to_json)
end

#to_json=(value) ⇒ Object



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

def to_json=(value)
  opts[:to_json] = value
end