Class: AIA::Tools
- Inherits:
-
Object
show all
- Defined in:
- lib/aia/tools.rb
Constant Summary
collapse
- @@catalog =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.catalog ⇒ Object
41
42
43
|
# File 'lib/aia/tools.rb', line 41
def catalog
@@catalog
end
|
29
30
31
|
# File 'lib/aia/tools.rb', line 29
def get_meta
@_metadata
end
|
.inherited(subclass) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/aia/tools.rb', line 11
def inherited(subclass)
subclass_meta = Hashie::Mash.new(klass: subclass)
subclass.instance_variable_set(:@_metadata, subclass_meta)
@@catalog << subclass_meta
end
|
46
47
48
49
50
|
# File 'lib/aia/tools.rb', line 46
def load_tools
Dir.glob(File.join(File.dirname(__FILE__), 'tools', '*.rb')).each do |file|
require file
end
end
|
19
20
21
22
23
24
25
26
|
# File 'lib/aia/tools.rb', line 19
def meta(metadata = nil)
return @_metadata if metadata.nil?
@_metadata = Hashie::Mash.new(metadata)
entry = @@catalog.detect { |item| item[:klass] == self }
entry.merge!(metadata) if entry
end
|
.search_for(criteria = {}) ⇒ Object
34
35
36
37
38
|
# File 'lib/aia/tools.rb', line 34
def search_for(criteria = {})
@@catalog.select do |meta|
criteria.all? { |k, v| meta[k] == v }
end
end
|
.setup_backend ⇒ Object
58
59
60
|
# File 'lib/aia/tools.rb', line 58
def setup_backend
AIA.config.tools.backend = find_and_initialize_backend
end
|
53
54
55
|
# File 'lib/aia/tools.rb', line 53
def validate_tools
raise "NotImplemented"
end
|
Instance Method Details
8
|
# File 'lib/aia/tools.rb', line 8
def meta = self.class::meta
|