Class: Compel::Validation::CustomValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/compel/validation/conditions/if.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(caller) ⇒ CustomValidator

Returns a new instance of CustomValidator.



27
28
29
# File 'lib/compel/validation/conditions/if.rb', line 27

def initialize(caller)
  ❨╯°□°❩╯︵┻━┻? caller
end

Instance Attribute Details

#callerObject (readonly)

Returns the value of attribute caller.



24
25
26
# File 'lib/compel/validation/conditions/if.rb', line 24

def caller
  @caller
end

#methodObject (readonly)

Returns the value of attribute method.



24
25
26
# File 'lib/compel/validation/conditions/if.rb', line 24

def method
  @method
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/compel/validation/conditions/if.rb', line 31

def valid?(value)
  caller.send(method, value)
end