Class: Veto::ConditionalBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/veto/blocks/conditional_block.rb

Instance Method Summary collapse

Methods inherited from Block

#<<, #children

Constructor Details

#initialize(options = {}) ⇒ ConditionalBlock

Returns a new instance of ConditionalBlock.



3
4
5
6
# File 'lib/veto/blocks/conditional_block.rb', line 3

def initialize(options={})
  @options = options
  super()
end

Instance Method Details

#call(*args) ⇒ Object



8
9
10
# File 'lib/veto/blocks/conditional_block.rb', line 8

def call(*args)
  call_children(*args) if conditions.pass?(*args)
end

#options(hash = {}) ⇒ Object



12
13
14
# File 'lib/veto/blocks/conditional_block.rb', line 12

def options(hash={})
  conditions_filter(:reject)
end