class Reactor::Plans::CommonAttribute
Constants
- ALLOWED_PARAMS
Public Class Methods
new()
click to toggle source
# File lib/reactor/plans/common_attribute.rb, line 9 def initialize @params = {} end
Public Instance Methods
migrate!()
click to toggle source
# File lib/reactor/plans/common_attribute.rb, line 17 def migrate! raise "#{self.class.name} did not implement migrate!" end
set(key,value)
click to toggle source
# File lib/reactor/plans/common_attribute.rb, line 13 def set(key,value) @params[key.to_sym] = value end
Protected Instance Methods
migrate_params!(attribute)
click to toggle source
# File lib/reactor/plans/common_attribute.rb, line 26 def migrate_params!(attribute) @params.each{|k,v|attribute.set(k,v)} attribute.save! end
prepare_params!(attribute=nil)
click to toggle source
# File lib/reactor/plans/common_attribute.rb, line 22 def prepare_params!(attribute=nil) @params.keys.each{|k| error("unknown parameter: #{k}") unless ALLOWED_PARAMS.include? k} end