Class: I18nAdmin::Errors::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_admin/errors/base.rb

Direct Known Subclasses

ResourceInvalid, ResourceNotFound

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/i18n_admin/errors/base.rb', line 4

def initialize(attributes = {})
  assign_attributes(attributes)
end

Instance Method Details

#assign_attributes(attributes = {}) ⇒ Object



8
9
10
11
12
# File 'lib/i18n_admin/errors/base.rb', line 8

def assign_attributes(attributes = {})
  attributes.each do |key, value|
    public_send(:"#{ key }=", value)
  end
end

#messagesObject



14
15
16
# File 'lib/i18n_admin/errors/base.rb', line 14

def messages
  @messages ||= []
end

#typeObject



18
19
20
# File 'lib/i18n_admin/errors/base.rb', line 18

def type
  self.class.name.demodulize.underscore.to_sym
end