Class: OctocatalogDiff::CatalogUtil::ENC
- Inherits:
-
Object
- Object
- OctocatalogDiff::CatalogUtil::ENC
- Defined in:
- lib/octocatalog-diff/catalog-util/enc.rb,
lib/octocatalog-diff/catalog-util/enc/pe.rb,
lib/octocatalog-diff/catalog-util/enc/noop.rb,
lib/octocatalog-diff/catalog-util/enc/pe/v1.rb,
lib/octocatalog-diff/catalog-util/enc/script.rb
Overview
Support a generic ENC. It must use one of the supported backends found in the ‘enc’ subdirectory.
Defined Under Namespace
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
-
#content(logger = nil) ⇒ String
Retrieve content.
-
#error_message(logger = nil) ⇒ String
Retrieve error message.
-
#execute(logger = nil) ⇒ Object
Execute the ‘execute’ method of the object, but only once.
-
#initialize(options = {}) ⇒ ENC
constructor
Constructor.
Constructor Details
#initialize(options = {}) ⇒ ENC
Constructor
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/octocatalog-diff/catalog-util/enc.rb', line 21 def initialize( = {}) @options = # Determine appropriate backend based on options supplied @enc_obj = backend # Initialize instance variables for content and error message. @builder = @enc_obj.class.to_s # Set the executed flag to false, so that it can be executed when something is retrieved. @executed = false end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
15 16 17 |
# File 'lib/octocatalog-diff/catalog-util/enc.rb', line 15 def builder @builder end |
Instance Method Details
#content(logger = nil) ⇒ String
Retrieve content
36 37 38 39 |
# File 'lib/octocatalog-diff/catalog-util/enc.rb', line 36 def content(logger = nil) execute(logger) @content ||= @enc_obj.content end |
#error_message(logger = nil) ⇒ String
Retrieve error message
43 44 45 46 |
# File 'lib/octocatalog-diff/catalog-util/enc.rb', line 43 def (logger = nil) execute(logger) @error_message ||= @enc_obj. end |
#execute(logger = nil) ⇒ Object
Execute the ‘execute’ method of the object, but only once
50 51 52 53 54 55 56 57 |
# File 'lib/octocatalog-diff/catalog-util/enc.rb', line 50 def execute(logger = nil) return if @executed logger ||= @options[:logger] logger ||= Logger.new(StringIO.new) @enc_obj.execute(logger) if @enc_obj.respond_to?(:execute) @executed = true override_enc_parameters(logger) end |