Class: Monban::Params::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/monban/params.rb

Defined Under Namespace

Classes: Factory

Instance Method Summary collapse

Constructor Details

#initialize(func, &message) ⇒ Validator

Returns a new instance of Validator.



16
17
18
19
# File 'lib/monban/params.rb', line 16

def initialize(func,&message)
  @func = func
  @message = message
end

Instance Method Details

#call(key, value) ⇒ Object



21
22
23
# File 'lib/monban/params.rb', line 21

def call(key,value)
  @func.call(key,value) or raise Monban::Params::Error, "#{key} #{@message && @message.call} : [#{value}]"
end