class Mongoid::Shell::Errors::Base
Attributes
problem[R]
Problem occurred.
resolution[R]
Suggested problem resolution.
summary[R]
Summary of the problem.
Public Instance Methods
compose_message(key, attributes = {})
click to toggle source
Compose the message.
Parameters¶ ↑
- key
-
Lookup key in the translation table.
- attributes
-
The objects to pass to create the message.
# File lib/mongoid/shell/errors/base.rb, line 18 def compose_message(key, attributes = {}) @problem = create_problem(key, attributes) @summary = create_summary(key, attributes) @resolution = create_resolution(key, attributes) "\nProblem:\n #{@problem}" \ "\nSummary:\n #{@summary}" \ "\nResolution:\n #{@resolution}" end
Private Instance Methods
create_problem(key, attributes)
click to toggle source
create_resolution(key, attributes)
click to toggle source
create_summary(key, attributes)
click to toggle source
translate(key, options)
click to toggle source
Given the key of the specific error and the options hash, translate the message.
Parameters¶ ↑
- key
-
The key of the error in the locales.
- options
-
The objects to pass to create the message.
Returns a localized error message string.
# File lib/mongoid/shell/errors/base.rb, line 40 def translate(key, options) ::I18n.translate("#{BASE_KEY}.#{key}", { locale: :en }.merge(options)).strip end