Module: Serega::SeregaPlanPoint::InstanceMethods

Included in:
Serega::SeregaPlanPoint
Defined in:
lib/serega/plan_point.rb

Overview

SeregaPlanPoint instance methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributeSeregaAttribute (readonly)

Shows current attribute

Returns:



18
19
20
# File 'lib/serega/plan_point.rb', line 18

def attribute
  @attribute
end

#child_planSeregaPlan? (readonly)

Shows child plan if exists

Returns:

  • (SeregaPlan, nil)

    Attribute serialization plan



22
23
24
# File 'lib/serega/plan_point.rb', line 22

def child_plan
  @child_plan
end

#modifiersHash (readonly)

Child fields to serialize

Returns:

  • (Hash)

    Attributes to serialize



26
27
28
# File 'lib/serega/plan_point.rb', line 26

def modifiers
  @modifiers
end

#planSeregaAttribute (readonly)

Link to current plan this point belongs to

Returns:



14
15
16
# File 'lib/serega/plan_point.rb', line 14

def plan
  @plan
end

Instance Method Details

#batch?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/serega/plan_point.rb', line 71

def batch?
  !attribute.batch_loaders.empty?
end

#batch_loadersObject

Attribute batch_loaders



77
78
79
# File 'lib/serega/plan_point.rb', line 77

def batch_loaders
  attribute.batch_loaders
end

#child_object_serializerSeregaObjectSerializer

Returns object serializer for child plan.

Returns:



84
85
86
# File 'lib/serega/plan_point.rb', line 84

def child_object_serializer
  serializer::SeregaObjectSerializer
end

#initialize(plan, attribute, modifiers = nil) ⇒ SeregaPlanPoint

Initializes plan point

Parameters:

  • plan (SeregaPlan)

    Current plan this point belongs to

  • attribute (SeregaAttribute)

    Attribute to construct plan point

  • modifiers (defaults to: nil)

    Serialization parameters

Options Hash (modifiers):

  • :only (Hash)

    The only attributes to serialize

  • :except (Hash)

    Attributes to hide

  • :with (Hash)

    Hidden attributes to serialize additionally

Returns:



40
41
42
43
44
45
# File 'lib/serega/plan_point.rb', line 40

def initialize(plan, attribute, modifiers = nil)
  @plan = plan
  @attribute = attribute
  @modifiers = modifiers
  set_normalized_vars
end

#manyObject

Attribute many option



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

def many
  attribute.many
end

#nameObject

Attribute name



55
56
57
# File 'lib/serega/plan_point.rb', line 55

def name
  attribute.name
end

#serializerObject

Attribute serializer option



67
68
69
# File 'lib/serega/plan_point.rb', line 67

def serializer
  attribute.serializer
end

#value(obj, ctx, batches: nil) ⇒ Object

Attribute value



49
50
51
# File 'lib/serega/plan_point.rb', line 49

def value(obj, ctx, batches: nil)
  attribute.value(obj, ctx, batches: batches)
end