Module: Serega::SeregaPlan::InstanceMethods
- Included in:
- Serega::SeregaPlan
- Defined in:
- lib/serega/plan.rb
Overview
SeregaPlan instance methods
Instance Attribute Summary collapse
-
#parent_plan_point ⇒ SeregaPlanPoint?
readonly
Parent plan point.
-
#points ⇒ Array<SeregaPlanPoint>
readonly
Serialization points.
-
#points_hash ⇒ Hash
readonly
Named serialization points.
Instance Method Summary collapse
-
#batch? ⇒ Boolean
Whether any point of this plan is batch loaded.
-
#data_class ⇒ Class
Returns the Data class whose members match this plan's serialized fields.
-
#initialize(parent_plan_point, modifiers) ⇒ SeregaPlan
Instantiate new serialization plan.
-
#serializer_class ⇒ Object
Serializer class of current plan.
Instance Attribute Details
#parent_plan_point ⇒ SeregaPlanPoint? (readonly)
Parent plan point
74 75 76 |
# File 'lib/serega/plan.rb', line 74 def parent_plan_point @parent_plan_point end |
#points ⇒ Array<SeregaPlanPoint> (readonly)
Serialization points
78 79 80 |
# File 'lib/serega/plan.rb', line 78 def points @points end |
#points_hash ⇒ Hash (readonly)
Named serialization points
82 83 84 |
# File 'lib/serega/plan.rb', line 82 def points_hash @points_hash end |
Instance Method Details
#batch? ⇒ Boolean
Returns whether any point of this plan is batch loaded.
114 115 116 117 118 |
# File 'lib/serega/plan.rb', line 114 def batch? return @batch if defined?(@batch) @batch = points.any?(&:batch?) end |
#data_class ⇒ Class
Returns the Data class whose members match this plan's serialized fields. Delegates to the class-level cache so identical field sets share one Data class.
125 126 127 |
# File 'lib/serega/plan.rb', line 125 def data_class @data_class ||= self.class.data_class_for(point_names) end |
#initialize(parent_plan_point, modifiers) ⇒ SeregaPlan
Instantiate new serialization plan
Patched by
- depth_limit plugin, which checks depth limit is not exceeded when adding new plan
98 99 100 101 102 |
# File 'lib/serega/plan.rb', line 98 def initialize(parent_plan_point, modifiers) @parent_plan_point = parent_plan_point @points = attributes_points(modifiers) @points_hash = points.to_h { |point| [point.name, point] } end |
#serializer_class ⇒ Object
Serializer class of current plan
107 108 109 |
# File 'lib/serega/plan.rb', line 107 def serializer_class self.class.serializer_class end |