Module: Serega::SeregaConfig::SeregaConfigInstanceMethods
- Included in:
- Serega::SeregaConfig
- Defined in:
- lib/serega/config.rb
Overview
SeregaConfig Instance methods
Instance Attribute Summary collapse
-
#opts ⇒ Hash
readonly
All config options.
Instance Method Summary collapse
-
#attribute_keys ⇒ Array<Symbol>
Allowed options keys for attribute initialization.
-
#check_initiate_params ⇒ Boolean
Current :check_initiate_params config option.
-
#check_initiate_params=(value) ⇒ Boolean
:check_initiate_params config option.
-
#from_json ⇒ #call
Callable that used to parse JSON.
-
#from_json=(value) ⇒ #call
Provided callable object.
-
#initialize(opts = nil) ⇒ Object
Initializes new config instance.
-
#initiate_keys ⇒ Array<Symbol>
Allowed options keys for serializer initialization.
-
#max_cached_map_per_serializer_count ⇒ Boolean
Current :max_cached_map_per_serializer_count config option.
-
#max_cached_map_per_serializer_count=(value) ⇒ Boolean
New :max_cached_map_per_serializer_count config option.
-
#plugins ⇒ Array
Used plugins.
-
#serialize_keys ⇒ Array<Symbol>
Allowed options keys for serialization.
-
#to_json ⇒ #call
Callable that used to construct JSON.
-
#to_json=(value) ⇒ #call
Provided callable object.
Instance Attribute Details
#opts ⇒ Hash (readonly)
Returns All config options.
28 29 30 |
# File 'lib/serega/config.rb', line 28 def opts @opts end |
Instance Method Details
#attribute_keys ⇒ Array<Symbol>
Returns Allowed options keys for attribute initialization.
51 52 53 |
# File 'lib/serega/config.rb', line 51 def attribute_keys opts.fetch(:attribute_keys) end |
#check_initiate_params ⇒ Boolean
Returns Current :check_initiate_params config option.
61 62 63 |
# File 'lib/serega/config.rb', line 61 def check_initiate_params opts.fetch(:check_initiate_params) end |
#check_initiate_params=(value) ⇒ Boolean
Returns :check_initiate_params config option.
68 69 70 71 |
# File 'lib/serega/config.rb', line 68 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_json ⇒ #call
Returns Callable that used to parse JSON.
98 99 100 |
# File 'lib/serega/config.rb', line 98 def from_json opts.fetch(:from_json) end |
#from_json=(value) ⇒ #call
Returns Provided callable object.
104 105 106 |
# File 'lib/serega/config.rb', line 104 def from_json=(value) opts[:from_json] = value end |
#initialize(opts = nil) ⇒ Object
Initializes new config instance.
35 36 37 38 |
# File 'lib/serega/config.rb', line 35 def initialize(opts = nil) opts ||= DEFAULTS @opts = SeregaUtils::EnumDeepDup.call(opts) end |
#initiate_keys ⇒ Array<Symbol>
Returns Allowed options keys for serializer initialization.
46 47 48 |
# File 'lib/serega/config.rb', line 46 def initiate_keys opts.fetch(:initiate_keys) end |
#max_cached_map_per_serializer_count ⇒ Boolean
Returns Current :max_cached_map_per_serializer_count config option.
74 75 76 |
# File 'lib/serega/config.rb', line 74 def max_cached_map_per_serializer_count opts.fetch(:max_cached_map_per_serializer_count) end |
#max_cached_map_per_serializer_count=(value) ⇒ Boolean
Returns New :max_cached_map_per_serializer_count config option.
81 82 83 84 |
# File 'lib/serega/config.rb', line 81 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 |
#plugins ⇒ Array
Returns Used plugins.
41 42 43 |
# File 'lib/serega/config.rb', line 41 def plugins opts.fetch(:plugins) end |
#serialize_keys ⇒ Array<Symbol>
Returns Allowed options keys for serialization.
56 57 58 |
# File 'lib/serega/config.rb', line 56 def serialize_keys opts.fetch(:serialize_keys) end |
#to_json ⇒ #call
Returns Callable that used to construct JSON.
87 88 89 |
# File 'lib/serega/config.rb', line 87 def to_json opts.fetch(:to_json) end |
#to_json=(value) ⇒ #call
Returns Provided callable object.
93 94 95 |
# File 'lib/serega/config.rb', line 93 def to_json=(value) opts[:to_json] = value end |