Class: RgGen::Core::InputBase::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core/input_base/verifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Verifier

Returns a new instance of Verifier.



7
8
9
# File 'lib/rggen/core/input_base/verifier.rb', line 7

def initialize(&block)
  instance_eval(&block)
end

Instance Method Details

#check_error(&block) ⇒ Object



11
12
13
# File 'lib/rggen/core/input_base/verifier.rb', line 11

def check_error(&block)
  @error_checker = block
end

#error_condition(&block) ⇒ Object



15
16
17
# File 'lib/rggen/core/input_base/verifier.rb', line 15

def error_condition(&block)
  @condition = block
end

#message(&block) ⇒ Object



19
20
21
# File 'lib/rggen/core/input_base/verifier.rb', line 19

def message(&block)
  @message = block
end

#verify(feature, *values) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rggen/core/input_base/verifier.rb', line 23

def verify(feature, *values)
  if @error_checker
    feature.instance_exec(*values, &@error_checker)
  else
    default_error_check(feature, values)
  end
end