Class: Kozo::Commands::State::Delete
- Inherits:
-
Kozo::Commands::State
- Object
- Kozo::Command
- Kozo::Commands::State
- Kozo::Commands::State::Delete
- Defined in:
- lib/kozo/commands/state/delete.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Attributes inherited from Kozo::Commands::State
Attributes inherited from Kozo::Command
Instance Method Summary collapse
-
#initialize(configuration, *args) ⇒ Delete
constructor
A new instance of Delete.
- #start ⇒ Object
Constructor Details
#initialize(configuration, *args) ⇒ Delete
Returns a new instance of Delete.
11 12 13 14 15 16 |
# File 'lib/kozo/commands/state/delete.rb', line 11 def initialize(configuration, *args) @configuration = configuration @address = args.shift raise UsageError, "address not specified" unless address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
9 10 11 |
# File 'lib/kozo/commands/state/delete.rb', line 9 def address @address end |
Instance Method Details
#start ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kozo/commands/state/delete.rb', line 18 def start resource = state .resources .find { |r| r.address == address } raise StateError, "no such resource address: #{address}" unless resource state .resources .delete_if { |r| r.address == address } Kozo.logger.info resource.address # Write state configuration .backend .state = state end |