Class: Mixture::Validate::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/mixture/validate/base.rb

Direct Known Subclasses

Match, Presence

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base



6
7
8
# File 'lib/mixture/validate/base.rb', line 6

def initialize(options)
  @options = options
end

Instance Method Details

#error(message) ⇒ Object



16
17
18
# File 'lib/mixture/validate/base.rb', line 16

def error(message)
  fail ValidationError, message
end

#validate(record, attribute, value) ⇒ Object



10
11
12
13
14
# File 'lib/mixture/validate/base.rb', line 10

def validate(record, attribute, value)
  @record = record
  @attribute = attribute
  @value = value
end