Class: Reactor::Plans::CommonObjClass
- Inherits:
-
Object
- Object
- Reactor::Plans::CommonObjClass
show all
- Includes:
- Prepared
- Defined in:
- lib/reactor/plans/common_obj_class.rb
Constant Summary
collapse
- ALLOWED_PARAMS =
[:completionCheck, :isEnabled, :recordSetCallback, :title,
:validContentTypes, :workflowModification]
Instance Method Summary
collapse
Methods included from Prepared
#error, #separate_arguments
Constructor Details
Returns a new instance of CommonObjClass.
10
11
12
13
14
15
16
17
18
|
# File 'lib/reactor/plans/common_obj_class.rb', line 10
def initialize
@take_attrs = []
@drop_attrs = []
@mandatory_attrs = []
@mandatory_drop_attrs = []
@preset_attrs = {}
@params = {}
@params_options = {}
end
|
Instance Method Details
#drop(attr_name, opts = {}) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/reactor/plans/common_obj_class.rb', line 38
def drop(attr_name, opts={})
attr_name = attr_name.to_s
@drop_attrs << attr_name
@take_attrs.delete(attr_name)
@mandatory_attrs.delete(attr_name)
@preset_attrs.delete(attr_name)
end
|
#migrate! ⇒ Object
46
47
48
|
# File 'lib/reactor/plans/common_obj_class.rb', line 46
def migrate!
raise "#{self.class.name} did not implement migrate!"
end
|
#preset(attribute, value) ⇒ Object
25
26
27
|
# File 'lib/reactor/plans/common_obj_class.rb', line 25
def preset(attribute, value)
@preset_attrs[attribute] = value
end
|
#set(key, value, options = {}) ⇒ Object
20
21
22
23
|
# File 'lib/reactor/plans/common_obj_class.rb', line 20
def set(key, value, options={})
@params_options[key.to_sym] = options
@params[key.to_sym] = value
end
|
#take(attr_name, opts = {}) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/reactor/plans/common_obj_class.rb', line 29
def take(attr_name, opts={})
attr_name = attr_name.to_s
@take_attrs << attr_name
@drop_attrs.delete(attr_name)
@mandatory_attrs << attr_name if opts[:mandatory] == true
@mandatory_drop_attrs << attr_name if opts[:mandatory] == false
@preset_attrs[attr_name] = opts[:preset] if opts.key? :preset
end
|