Class: R10K::Feature
- Inherits:
-
Object
- Object
- R10K::Feature
- Defined in:
- lib/r10k/feature.rb
Overview
Detect whether a given feature is present or absent
Defined Under Namespace
Classes: Collection
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.
Constructor Details
#initialize(name, opts = {}, &block) ⇒ Feature
Returns a new instance of Feature.
15 16 17 18 19 |
# File 'lib/r10k/feature.rb', line 15 def initialize(name, opts = {}, &block) @name = name @libraries = Array(opts.delete(:libraries)) @block = block || lambda { true } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/r10k/feature.rb', line 7 def name @name end |
Instance Method Details
#available? ⇒ true, false
Returns Is this feature available?.
22 23 24 |
# File 'lib/r10k/feature.rb', line 22 def available? @libraries.all? { |lib| library_available?(lib) } && !!@block.call end |