Class: ParamsReady::Helpers::ConditionalBlock

Inherits:
Conditional
  • Object
show all
Defined in:
lib/params_ready/helpers/conditional_block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Conditional

#perform?

Constructor Details

#initialize(rule: nil, &block) ⇒ ConditionalBlock

Returns a new instance of ConditionalBlock.

Raises:



24
25
26
27
28
# File 'lib/params_ready/helpers/conditional_block.rb', line 24

def initialize(rule: nil, &block)
  raise ParamsReadyError, "Block must not be empty" if block.nil?
  @block = block
  super(rule: rule)
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



22
23
24
# File 'lib/params_ready/helpers/conditional_block.rb', line 22

def block
  @block
end