Class: ExcelTemplating::Document::DataSourceRegistry
- Inherits:
-
Object
- Object
- ExcelTemplating::Document::DataSourceRegistry
show all
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/excel_templating/document/data_source_registry.rb
Overview
A registry for validation data sources within the excel spreadsheet DSL
Supports Enumerable#each for iterating the registry entries.
Defined Under Namespace
Classes: RegistryList, RegistryRenderer
Instance Method Summary
collapse
Constructor Details
Create an empty DataSourceRegistry
9
10
11
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 9
def initialize
@source_symbols = {}
end
|
Instance Method Details
29
30
31
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 29
def [](source_symbol)
source_symbols[source_symbol]
end
|
#add_list(source_symbol, title, list, inline) ⇒ Object
23
24
25
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 23
def add_list(source_symbol, title, list, inline)
source_symbols[source_symbol] = RegistryList.new(source_symbols.size + 1, source_symbol, title, list, inline)
end
|
#any_data_sheet_symbols? ⇒ TrueClass|FalseClass
39
40
41
42
43
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 39
def any_data_sheet_symbols?
select {|info|
info.data_sheet?
}.any?
end
|
#has_registry?(source_symbol) ⇒ Boolean
34
35
36
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 34
def has_registry?(source_symbol)
source_symbols.has_key?(source_symbol)
end
|
15
16
17
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 15
def renderer(data:)
RegistryRenderer.new(self, data)
end
|
#supported_registries ⇒ Array<Symbol>
46
47
48
|
# File 'lib/excel_templating/document/data_source_registry.rb', line 46
def supported_registries
source_symbols.keys
end
|