Class: RulesEngine::Rule::Definition
- Inherits:
-
Object
- Object
- RulesEngine::Rule::Definition
- Defined in:
- lib/rules_engine/rule/definition.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#attributes=(params) ⇒ Object
set the rule attributes.
-
#before_create ⇒ Object
callbacks when the rule is added and removed from a workflow.
- #before_destroy ⇒ Object
- #before_update ⇒ Object
- #data ⇒ Object
-
#data=(data) ⇒ Object
set the rule data.
- #errors ⇒ Object
- #expected_outcomes ⇒ Object
- #options ⇒ Object
-
#process(process_id, plan, data) ⇒ Object
execute the rule return an RulesEngine::Rule::Outcome object to define what to do next if nil to continue to the next rule.
- #summary ⇒ Object
-
#title ⇒ Object
get the rule attributes.
-
#valid? ⇒ Boolean
validation and errors.
Class Method Details
.inherited(base) ⇒ Object
4 5 6 |
# File 'lib/rules_engine/rule/definition.rb', line 4 def self.inherited(base) base.extend(ClassMethods) end |
Instance Method Details
#attributes=(params) ⇒ Object
set the rule attributes
45 46 |
# File 'lib/rules_engine/rule/definition.rb', line 45 def attributes=(params) end |
#before_create ⇒ Object
callbacks when the rule is added and removed from a workflow
61 62 |
# File 'lib/rules_engine/rule/definition.rb', line 61 def before_create() end |
#before_destroy ⇒ Object
67 68 |
# File 'lib/rules_engine/rule/definition.rb', line 67 def before_destroy() end |
#before_update ⇒ Object
64 65 |
# File 'lib/rules_engine/rule/definition.rb', line 64 def before_update() end |
#data ⇒ Object
35 36 37 |
# File 'lib/rules_engine/rule/definition.rb', line 35 def data return nil end |
#data=(data) ⇒ Object
set the rule data
22 23 |
# File 'lib/rules_engine/rule/definition.rb', line 22 def data= data end |
#errors ⇒ Object
54 55 56 57 |
# File 'lib/rules_engine/rule/definition.rb', line 54 def errors @errors ||= {} return @errors end |
#expected_outcomes ⇒ Object
39 40 41 |
# File 'lib/rules_engine/rule/definition.rb', line 39 def expected_outcomes [:outcome => RulesEngine::Rule::Outcome::NEXT] end |
#options ⇒ Object
16 17 18 |
# File 'lib/rules_engine/rule/definition.rb', line 16 def self.class. end |
#process(process_id, plan, data) ⇒ Object
execute the rule return an RulesEngine::Rule::Outcome object to define what to do next if nil to continue to the next rule
74 75 76 77 78 79 80 |
# File 'lib/rules_engine/rule/definition.rb', line 74 def process(process_id, plan, data) # process.audit("process #{title}", RulesEngine::Process::AUDIT_INFO) # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS) # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE) # RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'next_workflow') RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT) end |
#summary ⇒ Object
31 32 33 |
# File 'lib/rules_engine/rule/definition.rb', line 31 def summary return nil end |
#title ⇒ Object
get the rule attributes
27 28 29 |
# File 'lib/rules_engine/rule/definition.rb', line 27 def title return nil end |
#valid? ⇒ Boolean
validation and errors
50 51 52 |
# File 'lib/rules_engine/rule/definition.rb', line 50 def valid? true end |