Class: Foobara::Manifest::RootManifest
  
  
  
  Constant Summary
  
  
  TruncatedInspect::MAX_LENGTH
  Instance Attribute Summary collapse
  
  
  
  Attributes inherited from BaseManifest
  #path
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #inspect, truncating
  
  
  
  
  
  
  
  
  
  #==, #[], category_to_manifest_class, #domain, #eql?, #find_type, #global_domain, #global_organization, #hash, #key?, #method_missing, optional_key, #optional_key?, optional_key_defaults, optional_keys, #organization, #parent, #parent_category, #parent_name, #relevant_manifest, #respond_to_missing?, #scoped_category, #symbol_path
  Constructor Details
  
    
  
  
    #initialize(root_manifest)  ⇒ RootManifest 
  
  
  
  
    
Returns a new instance of RootManifest.
   
 
  
  
    
      
8
9
10 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 8
def initialize(root_manifest)
  super(root_manifest, [])
end 
     | 
  
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #root_manifest  ⇒ Object 
  
  
  
  
    
Returns the value of attribute root_manifest.
   
 
  
  
    
      
6
7
8 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 6
def root_manifest
  @root_manifest
end 
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #command_by_name(name)  ⇒ Object 
  
  
  
  
    
      
80
81
82 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 80
def command_by_name(name)
  Command.new(root_manifest, [:command, name])
end 
     | 
  
 
    
      
  
  
    #commands  ⇒ Object 
  
  
  
  
    
      
24
25
26 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 24
def commands
  organizations.map(&:commands).flatten
end 
     | 
  
 
    
      
  
  
    #contains?(reference, category)  ⇒ Boolean 
  
  
  
  
    
TODO: this isn’t quite right. If the thing is there but is nil or false, this should be truthy.
   
 
  
    
      
93
94
95 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 93
def contains?(reference, category)
  DataPath.value_at([category, reference], root_manifest)
end 
     | 
  
 
    
      
  
  
    #detached_entities  ⇒ Object 
  
  
  
  
    
      
34
35
36 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 34
def detached_entities
  organizations.map(&:detached_entities).flatten
end 
     | 
  
 
    
      
  
  
    #detached_entity_by_name(name)  ⇒ Object 
  
  
  
  
    
      
52
53
54
55
56
57
58 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 52
def detached_entity_by_name(name)
  type = type_by_name(name)
  raise "#{name} is not a detached entity" unless type.detached_entity?
  type
end
     | 
  
 
    
      
  
  
    #domain_by_name(name)  ⇒ Object 
  
  
  
  
    
      
84
85
86 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 84
def domain_by_name(name)
  Domain.new(root_manifest, [:domain, name])
end 
     | 
  
 
    
      
  
  
    #domains  ⇒ Object 
  
  
  
  
    
      
18
19
20
21
22 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 18
def domains
  @domains ||= DataPath.value_at(:domain, root_manifest).keys.map do |reference|
    Domain.new(root_manifest, [:domain, reference])
  end
end
     | 
  
 
    
      
  
  
    #entities  ⇒ Object 
  
  
  
  
    
      
38
39
40 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 38
def entities
  organizations.map(&:entities).flatten
end 
     | 
  
 
    
      
  
  
    #entity_by_name(name)  ⇒ Object 
  
  
  
  
    
      
60
61
62
63
64
65
66 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 60
def entity_by_name(name)
  type = type_by_name(name)
  raise "#{name} is not an entity" unless type.entity?
  type
end
     | 
  
 
    
      
  
  
    #errors  ⇒ Object 
  
  
  
  
    
      
46
47
48
49
50 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 46
def errors
  @errors ||= DataPath.value_at(:error, root_manifest).keys.map do |reference|
    Error.new(root_manifest, [:error, reference])
  end
end
     | 
  
 
    
      
  
  
    #lookup(reference)  ⇒ Object 
  
  
  
  
    
      
108
109
110
111
112
113
114
115
116
117
118
119
120
121 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 108
def lookup(reference)
  prioritized_categories = [:command, :type, :error, :domain, :organization, :processor, :processor_class]
  prioritized_categories.each do |category|
    path = [category, reference]
    raw_manifest = DataPath.value_at(path, root_manifest)
    if raw_manifest
      return self.class.category_to_manifest_class(category).new(root_manifest, path)
    end
  end
  nil
end
     | 
  
 
    
      
  
  
    #lookup_path(category, reference)  ⇒ Object 
  
  
  
  
    
      
97
98
99
100
101
102
103
104
105
106 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 97
def lookup_path(category, reference)
  path = [category, reference]
  raw_manifest = DataPath.value_at(path, root_manifest)
  if raw_manifest
    return self.class.category_to_manifest_class(category).new(root_manifest, path)
  end
  nil
end
     | 
  
 
    
      
  
  
    #model_by_name(name)  ⇒ Object 
  
  
  
  
    
      
68
69
70
71
72
73
74 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 68
def model_by_name(name)
  type = type_by_name(name)
  raise "#{name} is not a model" unless type.model?
  type
end
     | 
  
 
    
      
  
  
    #models  ⇒ Object 
  
  
  
  
    
      
42
43
44 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 42
def models
  organizations.map(&:models).flatten
end 
     | 
  
 
    
      
  
  
    #organization_by_name(name)  ⇒ Object 
  
  
  
  
    
      
88
89
90 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 88
def organization_by_name(name)
  Organization.new(root_manifest, [:organization, name])
end 
     | 
  
 
    
      
  
  
    #organizations  ⇒ Object 
  
  
  
  
    
      
12
13
14
15
16 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 12
def organizations
  @organizations ||= DataPath.value_at(:organization, root_manifest).keys.map do |reference|
    Organization.new(root_manifest, [:organization, reference])
  end
end
     | 
  
 
    
      
  
  
    #type_by_name(name)  ⇒ Object 
  
  
  
  
    
      
76
77
78 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 76
def type_by_name(name)
  Type.new(root_manifest, [:type, name])
end 
     | 
  
 
    
      
  
  
    #types  ⇒ Object 
  
  
  
  
    
      
28
29
30
31
32 
     | 
    
      # File 'foobara-0.2.2/projects/manifest/src/foobara/manifest/root_manifest.rb', line 28
def types
  @types ||= DataPath.value_at(:type, root_manifest).keys.map do |reference|
    Type.new(root_manifest, [:type, reference])
  end
end
     |