Class: Ohm::Validations::Errors

Inherits:
Array
  • Object
show all
Defined in:
lib/ohm/validations.rb

Overview

A simple class for storing all errors. Since Errors extends Array, you can expect all array methods to work on it.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Errors) initialize(model)

A new instance of Errors



108
109
110
# File 'lib/ohm/validations.rb', line 108

def initialize(model)
  @model = model
end

Instance Attribute Details

- (Object) model

Returns the value of attribute model



106
107
108
# File 'lib/ohm/validations.rb', line 106

def model
  @model
end

Instance Method Details

- (Object) present(presenter = Presenter, &block)



112
113
114
# File 'lib/ohm/validations.rb', line 112

def present(presenter = Presenter, &block)
  presenter.new(model.errors).present(&block)
end