Module: WithConditions
- Defined in:
- lib/with_conditions.rb,
lib/with_conditions/version.rb,
lib/with_conditions/options_merger.rb
Defined Under Namespace
Classes: OptionMerger
Constant Summary collapse
- VERSION =
"1.1.0"
Instance Method Summary collapse
Instance Method Details
#with_conditions(if: nil, unless: nil, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/with_conditions.rb', line 7 def with_conditions(if: nil, unless: nil, &block) option_merger = WithConditions::OptionMerger.new(self, if:, unless:) if block block.arity.zero? ? option_merger.instance_eval(&block) : block.call(option_merger) else option_merger end end |