Module: Serega::SeregaPlan::ClassMethods

Included in:
Serega::SeregaPlan
Defined in:
lib/serega/plan.rb

Overview

SeregaPlan class methods

Instance Method Summary collapse

Instance Method Details

#call(opts) ⇒ SeregaPlan

Constructs plan of attributes that should be serialized.

Parameters:

  • opts

    Serialization parameters

Options Hash (opts):

  • :only (Hash)

    The only attributes to serialize

  • :except (Hash)

    Attributes to hide

  • :with (Hash)

    Attributes (usually marked ‘hide: true`) to serialize additionally

Returns:



23
24
25
26
27
28
# File 'lib/serega/plan.rb', line 23

def call(opts)
  max_cache_size = serializer_class.config.max_cached_plans_per_serializer_count
  return new(nil, opts) if max_cache_size.zero?

  cached_plan_for(opts, max_cache_size)
end