Module: Foobara::IsManifestable

Included in:
CommandRegistry::ExposedCommand, Manifestable::ClassMethods, Types::Type, Value::Processor
Defined in:
foobara-0.0.110/projects/domain/src/is_manifestable.rb

Instance Method Summary collapse

Instance Method Details

#foobara_domainObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'foobara-0.0.110/projects/domain/src/is_manifestable.rb', line 14

def foobara_domain
  return @foobara_domain if defined?(@foobara_domain)

  scoped = self

  while scoped
    if scoped.is_a?(::Module)
      if scoped.foobara_domain?
        return @foobara_domain = scoped
      end
    end

    scoped = scoped.scoped_namespace
  end

  @foobara_domain = GlobalDomain
end

#foobara_manifestObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'foobara-0.0.110/projects/domain/src/is_manifestable.rb', line 40

def foobara_manifest
  to_include = TypeDeclarations.foobara_manifest_context_to_include

  h = {
    scoped_path:,
    scoped_name:,
    scoped_short_name:,
    scoped_prefix:,
    scoped_full_path:,
    scoped_full_name:,
    scoped_category:,
    reference: foobara_manifest_reference,
    domain: foobara_domain&.foobara_manifest_reference,
    organization: foobara_organization&.foobara_manifest_reference
  }

  parent = scoped_namespace

  if parent
    parent_category = Namespace.global.foobara_category_symbol_for(parent)

    if parent_category
      if to_include
        to_include << parent
      end
      h[:parent] = [parent_category, parent.foobara_manifest_reference]
    end
  end

  h
end

#foobara_organizationObject



32
33
34
35
36
37
38
# File 'foobara-0.0.110/projects/domain/src/is_manifestable.rb', line 32

def foobara_organization
  if is_a?(::Module) && foobara_organization?
    self
  else
    foobara_domain.foobara_organization
  end
end

#scoped_clear_cachesObject



3
4
5
6
7
8
9
10
11
12
# File 'foobara-0.0.110/projects/domain/src/is_manifestable.rb', line 3

def scoped_clear_caches
  [
    # TODO: what about this one??
    # "@created_in_namespace",
    "@foobara_domain"
  ].each do |variable|
    remove_instance_variable(variable) if instance_variable_defined?(variable)
  end
  super
end