Class: Reactor::Plans::UpdateObj
- Inherits:
-
Object
- Object
- Reactor::Plans::UpdateObj
show all
- Includes:
- Prepared
- Defined in:
- lib/reactor/plans/update_obj.rb
Instance Method Summary
collapse
Methods included from Prepared
#error, #separate_arguments
Constructor Details
#initialize(opts = {}) ⇒ UpdateObj
Returns a new instance of UpdateObj.
7
8
9
10
|
# File 'lib/reactor/plans/update_obj.rb', line 7
def initialize(opts={})
@key = opts[:obj_id] || opts[:path]
@attrs = {}
end
|
Instance Method Details
#migrate! ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/reactor/plans/update_obj.rb', line 21
def migrate!
obj = Reactor::Cm::Obj.get(@key)
@attrs.each do |key,value|
@obj.set(key,value)
end
@obj.save!
@obj.release!
end
|
#prepare! ⇒ Object
16
17
18
19
|
# File 'lib/reactor/plans/update_obj.rb', line 16
def prepare!
error("object (key=#{@key}) not found") if not Reactor::Cm::Obj.exists?(@key)
end
|
#set(key, value) ⇒ Object
12
13
14
|
# File 'lib/reactor/plans/update_obj.rb', line 12
def set(key, value)
@attrs[key.to_sym] = value
end
|