Module: Parser::Messages Private
| Relationships & Source Files | |
| Defined in: | lib/rubocop/ast/vendor/parser/messages.rb |
Class Method Summary
-
.compile(reason, arguments)
Internal use only
Formats the message, returns a raw template if there’s nothing to interpolate.
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.
# 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