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 =
i(completionCheck isEnabled recordSetCallback title
validContentTypes workflowModification).freeze
Instance Method Summary
collapse
Methods included from Prepared
#error, #separate_arguments
Constructor Details
Returns a new instance of CommonObjClass.
9
10
11
12
13
14
15
16
17
|
# File 'lib/reactor/plans/common_obj_class.rb', line 9
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
37
38
39
40
41
42
43
|
# File 'lib/reactor/plans/common_obj_class.rb', line 37
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
45
46
47
|
# File 'lib/reactor/plans/common_obj_class.rb', line 45
def migrate!
raise "#{self.class.name} did not implement migrate!"
end
|
#preset(attribute, value) ⇒ Object
24
25
26
|
# File 'lib/reactor/plans/common_obj_class.rb', line 24
def preset(attribute, value)
@preset_attrs[attribute] = value
end
|
#set(key, value, options = {}) ⇒ Object
19
20
21
22
|
# File 'lib/reactor/plans/common_obj_class.rb', line 19
def set(key, value, options = {})
@params_options[key.to_sym] = options
@params[key.to_sym] = value
end
|
#take(attr_name, opts = {}) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/reactor/plans/common_obj_class.rb', line 28
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
|