module TerRor::Model

Public Instance Methods

on_error(name, &block) click to toggle source
# File lib/ter_ror/model.rb, line 12
def on_error(name, &block)
  self.error_modifiers ||= {}
  error_modifiers[name.to_s] = block
end
terrors() click to toggle source
# File lib/ter_ror/model.rb, line 18
def terrors
  TerRor.serialize(self).map do |name, definition|
    if error_modifiers&.has_key?(name)
      instance_exec(definition, &error_modifiers[name])
    end

    definition
  end
end