123456789_123456789_123456789_123456789_123456789_

Module: Parser::Messages Private

Relationships & Source Files
Defined in: lib/rubocop/ast/vendor/parser/messages.rb

Class Method Summary

Class Method Details

.compile(reason, arguments)

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.

[ GitHub ]

  
# File 'lib/rubocop/ast/vendor/parser/messages.rb', line 119

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