Class: R10K::Feature
Overview
Detect whether a given feature is present or absent
Defined Under Namespace
Classes: Collection
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#available? ⇒ true, false
Is this feature available?.
-
#initialize(name, opts = {}, &block) ⇒ Feature
constructor
A new instance of Feature.
Methods included from Logging
debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(name, opts = {}, &block) ⇒ Feature
Returns a new instance of Feature.
19 20 21 22 23 |
# File 'lib/r10k/feature.rb', line 19 def initialize(name, opts = {}, &block) @name = name @libraries = Array(opts.delete(:libraries)) @block = block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/r10k/feature.rb', line 11 def name @name end |
Instance Method Details
#available? ⇒ true, false
Returns Is this feature available?.
26 27 28 29 30 31 32 |
# File 'lib/r10k/feature.rb', line 26 def available? logger.debug1 { "Testing to see if feature #{@name} is available." } rv = @libraries.all? { |lib| library_available?(lib) } && proc_available? msg = rv ? "is" : "is not" logger.debug1 { "Feature #{@name} #{msg} available." } rv end |