module Veto

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/veto.rb, line 40
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/veto.rb, line 36
def self.configure
  yield(configuration)
end
model(validator) click to toggle source

Provides access to the anonymous model extension module

@example

class Person
 include Veto.model(PersonValidator)
end

@param validator [Class] the Veto validator class @return [Module] the object converted into the expected format.

# File lib/veto.rb, line 27
def self.model validator
  mod = Module.new
  mod.define_singleton_method :included do |base|
    base.send(:include, ::Veto::Model)
    base.validates_with validator
  end
  mod
end
validator() click to toggle source

Provides access to the anonymous validator extension module

@example

class PersonValidator
 include Veto.validator
end

@return [Module] the object converted into the expected format.

# File lib/veto.rb, line 10
def self.validator
  mod = Module.new
  mod.define_singleton_method :included do |base|
    base.send(:include, ::Veto::Validator)
  end
  mod
end