class Veto::ConditionalBlock

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Veto::Block::new
# File lib/veto/blocks/conditional_block.rb, line 3
def initialize(options={})
  @options = options
  super()
end

Public Instance Methods

call(*args) click to toggle source
# File lib/veto/blocks/conditional_block.rb, line 8
def call(*args)
  call_children(*args) if conditions.pass?(*args)
end
options(hash={}) click to toggle source
# File lib/veto/blocks/conditional_block.rb, line 12
def options(hash={})
  conditions_filter(:reject)
end

Private Instance Methods

conditions() click to toggle source
# File lib/veto/blocks/conditional_block.rb, line 18
def conditions
  IfUnlessConditions.new(conditions_filter(:select))
end
conditions_filter(type) click to toggle source
# File lib/veto/blocks/conditional_block.rb, line 22
def conditions_filter(type)
  @options.send(type){|k,v| [:if, :unless].include?(k)}
end