Module: Parser::Messages Private

Defined in:
lib/parser/messages.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.compile(reason, arguments) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Formats the message, returns a raw template if there’s nothing to interpolate

Code like ‘format(“”, {})` gives a warning, and so this method tries interpolating only if `arguments` hash is not empty.



112
113
114
115
116
# File 'lib/parser/messages.rb', line 112

def self.compile(reason, arguments)
  template = MESSAGES[reason]
  return template if Hash === arguments && arguments.empty?
  format(template, arguments)
end