class Loom::Pattern::Reference
See Loom::Pattern::Pattern
for the difference between refs and patterns.
Attributes
desc[R]
pattern[R]
slug[R]
source_file[R]
Public Class Methods
new(slug, pattern, source_file, definition_ctx)
click to toggle source
# File lib/loom/pattern/reference.rb, line 7 def initialize(slug, pattern, source_file, definition_ctx) @slug = slug @source_file = source_file @definition_ctx = definition_ctx @desc = pattern.description @pattern = pattern end
Public Instance Methods
call(shell_api, host_fact_set)
click to toggle source
# File lib/loom/pattern/reference.rb, line 21 def call(shell_api, host_fact_set) run_context = RunContext.new @pattern, @definition_ctx fact_set = @definition_ctx.fact_set host_fact_set Loom.log.debug5(self) { "fact set for pattern execution => #{fact_set.facts}" } # TODO: wrap up this fact_set in a delegator/facade/proxy to eliminate the # .loom file from directly accessing it. Add logging and deprecation # warnings there.... like FactSet+hostname+ currently. @definition_ctx.define_let_readers run_context, fact_set begin run_context.run shell_api, fact_set rescue => e error_msg = "error executing '#{slug}' in #{source_file} =>\n\t#{e}\n%s" Loom.log.error(error_msg % e.backtrace.join("\n\t")) raise end end
expand_slugs()
click to toggle source
Used by Loom::Pattern::Loader
to expand weaves. A Pattern::Reference
it just expands to itself.
# File lib/loom/pattern/reference.rb, line 17 def expand_slugs @slug end