Class: Capistrano::Role::DynamicServerList
- Inherits:
-
Object
- Object
- Capistrano::Role::DynamicServerList
- Defined in:
- lib/capistrano/role.rb
Overview
This is the combination of a block, a hash of options, and a cached value.
Instance Method Summary collapse
-
#initialize(block, options) ⇒ DynamicServerList
constructor
A new instance of DynamicServerList.
-
#reset! ⇒ Object
Clear the cached value.
-
#to_ary ⇒ Object
Convert to a list of ServerDefinitions.
Constructor Details
#initialize(block, options) ⇒ DynamicServerList
Returns a new instance of DynamicServerList.
45 46 47 48 49 50 |
# File 'lib/capistrano/role.rb', line 45 def initialize (block, ) @block = block @options = @cached = [] @is_cached = false end |
Instance Method Details
#reset! ⇒ Object
Clear the cached value
62 63 64 65 |
# File 'lib/capistrano/role.rb', line 62 def reset! @cached.clear @is_cached = false end |
#to_ary ⇒ Object
Convert to a list of ServerDefinitions
53 54 55 56 57 58 59 |
# File 'lib/capistrano/role.rb', line 53 def to_ary unless @is_cached @cached = Role::wrap_list(@block.call(@options), @options) @is_cached = true end @cached end |