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.



119
120
121
122
123
# File 'lib/parser/messages.rb', line 119

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