Class: ActiveModel::BetterErrors::Formatter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/active_model/better_errors/formatter.rb

Overview

Abstract Formatter class

Direct Known Subclasses

HumanMessageFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, error_message) ⇒ Formatter

Returns a new instance of Formatter.



14
15
16
# File 'lib/active_model/better_errors/formatter.rb', line 14

def initialize(base, error_message)
  @base, @error_message = base, error_message
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



12
13
14
# File 'lib/active_model/better_errors/formatter.rb', line 12

def base
  @base
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



12
13
14
# File 'lib/active_model/better_errors/formatter.rb', line 12

def error_message
  @error_message
end

Instance Method Details

#format_messageObject

This method is abstract.

Formats the error message into a comsumable string. see HumanMessageFormatter for more details.



22
23
# File 'lib/active_model/better_errors/formatter.rb', line 22

def format_message
end