Class: Cfhighlander::Factory::ComponentFactory
- Inherits:
-
Object
- Object
- Cfhighlander::Factory::ComponentFactory
- Defined in:
- lib/cfhighlander.factory.rb
Instance Attribute Summary collapse
-
#component_sources ⇒ Object
Returns the value of attribute component_sources.
Instance Method Summary collapse
- #buildComponentFromLocation(template_meta, component_name) ⇒ Object
-
#initialize(component_sources = [], parent_path = nil) ⇒ ComponentFactory
constructor
A new instance of ComponentFactory.
-
#loadComponentFromTemplate(template_name, template_version = nil, component_name = nil) ⇒ Cfhighlander::Factory::Component
Find component and given list of sources.
Constructor Details
#initialize(component_sources = [], parent_path = nil) ⇒ ComponentFactory
Returns a new instance of ComponentFactory.
16 17 18 19 |
# File 'lib/cfhighlander.factory.rb', line 16 def initialize(component_sources = [], parent_path=nil) @template_finder = Cfhighlander::Factory::TemplateFinder.new(component_sources, parent_path) @component_sources = component_sources end |
Instance Attribute Details
#component_sources ⇒ Object
Returns the value of attribute component_sources.
14 15 16 |
# File 'lib/cfhighlander.factory.rb', line 14 def component_sources @component_sources end |
Instance Method Details
#buildComponentFromLocation(template_meta, component_name) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/cfhighlander.factory.rb', line 36 def buildComponentFromLocation(, component_name) component = Model::Component.new(, component_name, self) component.factory = self component.load_config return component end |
#loadComponentFromTemplate(template_name, template_version = nil, component_name = nil) ⇒ Cfhighlander::Factory::Component
Find component and given list of sources
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cfhighlander.factory.rb', line 23 def loadComponentFromTemplate(template_name, template_version = nil, component_name = nil) = @template_finder.findTemplate(template_name, template_version) raise StandardError, "highlander template #{template_name}@#{template_version} not located" + " in sources #{@component_sources}" if .nil? component_name = .template_name if component_name.nil? return buildComponentFromLocation(, component_name) end |