Class: Loom::Pattern::Reference
- Inherits:
-
Object
- Object
- Loom::Pattern::Reference
- Defined in:
- lib/loom/pattern/reference.rb
Defined Under Namespace
Classes: RunContext
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Instance Method Summary collapse
- #call(shell_api, host_fact_set) ⇒ Object
-
#initialize(slug, unbound_method, source_file, definition_ctx, description) ⇒ Reference
constructor
A new instance of Reference.
- #is_expanding? ⇒ Boolean
Constructor Details
#initialize(slug, unbound_method, source_file, definition_ctx, description) ⇒ Reference
Returns a new instance of Reference.
6 7 8 9 10 11 12 |
# File 'lib/loom/pattern/reference.rb', line 6 def initialize(slug, unbound_method, source_file, definition_ctx, description) @slug = slug @unbound_method = unbound_method @source_file = source_file @definition_ctx = definition_ctx @desc = description end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
4 5 6 |
# File 'lib/loom/pattern/reference.rb', line 4 def desc @desc end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
4 5 6 |
# File 'lib/loom/pattern/reference.rb', line 4 def slug @slug end |
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
4 5 6 |
# File 'lib/loom/pattern/reference.rb', line 4 def source_file @source_file end |
Instance Method Details
#call(shell_api, host_fact_set) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/loom/pattern/reference.rb', line 18 def call(shell_api, host_fact_set) run_context = RunContext.new @unbound_method, @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} => #{e} \n%s" Loom.log.error(error_msg % e.backtrace.join("\n\t")) raise end end |
#is_expanding? ⇒ Boolean
14 15 16 |
# File 'lib/loom/pattern/reference.rb', line 14 def false end |