Module: SmqlToAR::Assertion
- Included in:
- ConditionTypes, ConditionTypes::Condition, ConditionTypes::Condition, ConditionTypes::Functions::Function
- Defined in:
- lib/smql_to_ar.rb
Instance Method Summary collapse
- #raise_if(cond, exception = nil, *args) ⇒ Object
- #raise_unless(cond, exception = nil, *args) ⇒ Object
Instance Method Details
#raise_if(cond, exception = nil, *args) ⇒ Object
24 25 26 27 |
# File 'lib/smql_to_ar.rb', line 24 def raise_if cond, exception = nil, *args cond, exception, *args = yield. cond, exception, *args if block_given? raise exception || Exception, *args if cond end |
#raise_unless(cond, exception = nil, *args) ⇒ Object
19 20 21 22 |
# File 'lib/smql_to_ar.rb', line 19 def raise_unless cond, exception = nil, *args cond, exception, *args = yield. cond, exception, *args if block_given? raise exception || Exception, *args unless cond end |