Class: ParamsReady::Helpers::Conditional
- Inherits:
-
Object
- Object
- ParamsReady::Helpers::Conditional
- Defined in:
- lib/params_ready/helpers/conditional_block.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(rule: nil) ⇒ Conditional
constructor
A new instance of Conditional.
- #perform?(general_rule, name) ⇒ Boolean
Constructor Details
#initialize(rule: nil) ⇒ Conditional
Returns a new instance of Conditional.
7 8 9 10 |
# File 'lib/params_ready/helpers/conditional_block.rb', line 7 def initialize(rule: nil) @rule = Helpers::Rule(rule) freeze end |
Instance Method Details
#perform?(general_rule, name) ⇒ Boolean
12 13 14 15 16 17 18 |
# File 'lib/params_ready/helpers/conditional_block.rb', line 12 def perform?(general_rule, name) if @rule.nil? general_rule else @rule.include?(name) end end |