Module: Foobara::CommandPatternImplementation::Concerns::EntityReflection::ClassMethods

Defined in:
foobara-0.6.1/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_reflection.rb

Instance Method Summary collapse

Instance Method Details

#types_depended_onObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_reflection.rb', line 8

def types_depended_on
  # These lookups are duplicative of the overriden method as well as other methods.
  # Likely there's some way to DRY this up
  remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?

  if defined?(@types_depended_on) && @types_depended_on.key?(remove_sensitive)
    return @types_depended_on[remove_sensitive]
  end

  @types_depended_on ||= {}
  @types_depended_on[remove_sensitive] = begin
    types = super

    unless depends_on_entities.empty?
      entity_types = depends_on_entities.map(&:entity_type)

      if remove_sensitive
        entity_types = entity_types.reject(&:sensitive?)
      end

      types |= entity_types
      types |= entity_types.map(&:types_depended_on).inject(:|)
    end

    types
  end
end