Class: Veto::Checker

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Block

#<<, #call, #children

Constructor Details

#initialize(&block) ⇒ Checker

Returns a new instance of Checker.



9
10
11
12
# File 'lib/veto/blocks/checker.rb', line 9

def initialize(&block)
  super
  instance_eval(&block) if block_given?
end

Class Method Details

.from_children(children = []) ⇒ Object



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

def self.from_children(children=[])
  inst = new
  children.each{|child| inst << child }
  inst
end

Instance Method Details

#validate(*args) ⇒ Object



18
19
20
# File 'lib/veto/blocks/checker.rb', line 18

def validate(*args)
  self << ValidateBlock.build(*args)
end

#validates(*args) ⇒ Object



14
15
16
# File 'lib/veto/blocks/checker.rb', line 14

def validates(*args)
  self << ValidatesBlock.build(*args)
end

#with_options(*args, &block) ⇒ Object



22
23
24
25
26
# File 'lib/veto/blocks/checker.rb', line 22

def with_options(*args, &block)
  b = WithOptionsBlock.build(*args)
  b << self.class.new(&block)
  self << b
end