Class: Reactor::Plans::UpdateAttribute

Inherits:
CommonAttribute show all
Defined in:
lib/reactor/plans/update_attribute.rb

Constant Summary

Constants inherited from CommonAttribute

CommonAttribute::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonAttribute

#set

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ UpdateAttribute

Returns a new instance of UpdateAttribute.



5
6
7
8
9
# File 'lib/reactor/plans/update_attribute.rb', line 5

def initialize(*args)
  super()
  (name, x), options = separate_arguments(*args)
  @name = name || options[:name]
end

Instance Method Details

#migrate!Object



17
18
19
20
# File 'lib/reactor/plans/update_attribute.rb', line 17

def migrate!
  attrib = Reactor::Cm::Attribute.get(@name)
  migrate_params!(attrib)
end

#prepapre!Object



11
12
13
14
15
# File 'lib/reactor/plans/update_attribute.rb', line 11

def prepapre!
  error("name is nil") if @name.nil?
  error("attribute #{@name} not found") if not Reactor::Cm::Attribute.exists?(@name)
  prepare_params!(nil)
end