Sha256: 46354d1c7745d92d832c7e6c933db2d38b3cc5cd7a79d77218de3ff0b39fe069
Contents?: true
Size: 1.49 KB
Versions: 4
Compression:
Stored size: 1.49 KB
Contents
module Simplabs module Excellent # The warnings returned by Excellent provide information about the +file+ the *possibly* problematic code was found in as well as the +line+ of the # occurence, a warning message and a Hash with specific information about the warning. # # Warnings also provide the message template that was used to generate the message. The message template contains tokens like <tt>{{token}}</tt> that # correspond to the valeus in the +info+ hash, e.g.: # # '{{method}} has abc score of {{score}}.' # { :method => 'User#full_name', :score => 10 } class Warning # The check that produced the warning attr_reader :check # The name of the file the check found the problematic code in attr_reader :filename # The file number where the check found the problematic code attr_reader :line_number # The warning message attr_reader :message # Additional info for the warning (see above) attr_reader :info # The template used to produce the warning (see above) attr_reader :message_template def initialize(message, filename, line_number, info) #:nodoc: @info = info @filename = filename @line_number = line_number.to_i @message = '' if !message.nil? @message_template = message @info.each { |key, value| message.gsub!(/\{\{#{key}\}\}/, value.to_s) } @message = message end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems