Module: ConditionatorHooks::ClassLevelConditionator
- Defined in:
- lib/conditionator/hooks.rb
Instance Method Summary collapse
- #data ⇒ Object
- #data=(value) ⇒ Object
- #postcondition_for(method_name, conditions, options = {}) ⇒ Object
-
#precondition_for(method_name, preconditions, options = {}) ⇒ Object
Adds a precondition for the method ‘method_name’ method_name can be an array of methods, in which case, we add the same preconditions for all methos inside it.
Instance Method Details
#data ⇒ Object
111 112 113 114 |
# File 'lib/conditionator/hooks.rb', line 111 def data @data = {} if @data.nil? @data end |
#data=(value) ⇒ Object
115 116 117 |
# File 'lib/conditionator/hooks.rb', line 115 def data=(value) @data = value end |
#postcondition_for(method_name, conditions, options = {}) ⇒ Object
132 133 134 135 136 137 138 139 140 |
# File 'lib/conditionator/hooks.rb', line 132 def postcondition_for method_name, conditions, = {} if method_name.is_a? Array method_name.each do |m| add_condition_for :post, m, conditions, end else add_condition_for :post, method_name, conditions, end end |
#precondition_for(method_name, preconditions, options = {}) ⇒ Object
Adds a precondition for the method ‘method_name’ method_name can be an array of methods, in which case, we add the same preconditions for all methos inside it.
122 123 124 125 126 127 128 129 130 |
# File 'lib/conditionator/hooks.rb', line 122 def precondition_for method_name, preconditions, = {} if method_name.is_a? Array method_name.each do |m| add_condition_for :pre, m, preconditions, end else add_condition_for :pre, method_name, preconditions, end end |