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
34
35
36
37
38
39
40
|
# File 'lib/reactor/plans/common_obj_class.rb', line 34
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
42
43
44
|
# File 'lib/reactor/plans/common_obj_class.rb', line 42
def migrate!
raise "#{self.class.name} did not implement migrate!"
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
25
26
27
28
29
30
31
32
|
# File 'lib/reactor/plans/common_obj_class.rb', line 25
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
|