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.
49 50 51 52 53 54 |
# File 'lib/capistrano/role.rb', line 49 def initialize (block, ) @block = block @options = @cached = [] @is_cached = false end |
Instance Method Details
#reset! ⇒ Object
Clear the cached value
66 67 68 69 |
# File 'lib/capistrano/role.rb', line 66 def reset! @cached.clear @is_cached = false end |
#to_ary ⇒ Object
Convert to a list of ServerDefinitions
57 58 59 60 61 62 63 |
# File 'lib/capistrano/role.rb', line 57 def to_ary unless @is_cached @cached = Role::wrap_list(@block.call(@options), @options) @is_cached = true end @cached end |