Class: ChefMetal::AddPrefixActionHandler
- Inherits:
-
Object
- Object
- ChefMetal::AddPrefixActionHandler
- Extended by:
- Forwardable
- Defined in:
- lib/chef_metal/add_prefix_action_handler.rb
Instance Attribute Summary collapse
-
#action_handler ⇒ Object
readonly
Returns the value of attribute action_handler.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(action_handler, prefix) ⇒ AddPrefixActionHandler
constructor
A new instance of AddPrefixActionHandler.
- #perform_action(description, &block) ⇒ Object
- #performed_action(description) ⇒ Object
Constructor Details
#initialize(action_handler, prefix) ⇒ AddPrefixActionHandler
Returns a new instance of AddPrefixActionHandler.
7 8 9 10 |
# File 'lib/chef_metal/add_prefix_action_handler.rb', line 7 def initialize(action_handler, prefix) @action_handler = action_handler @prefix = prefix end |
Instance Attribute Details
#action_handler ⇒ Object (readonly)
Returns the value of attribute action_handler.
12 13 14 |
# File 'lib/chef_metal/add_prefix_action_handler.rb', line 12 def action_handler @action_handler end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
13 14 15 |
# File 'lib/chef_metal/add_prefix_action_handler.rb', line 13 def prefix @prefix end |
Instance Method Details
#perform_action(description, &block) ⇒ Object
23 24 25 |
# File 'lib/chef_metal/add_prefix_action_handler.rb', line 23 def perform_action(description, &block) action_handler.perform_action(Array(description).map { |d| "#{prefix}#{d}" }, &block) end |
#performed_action(description) ⇒ Object
19 20 21 |
# File 'lib/chef_metal/add_prefix_action_handler.rb', line 19 def performed_action(description) action_handler.performed_action(Array(description).map { |d| "#{prefix}#{d}" }) end |