class Epuber::Checker::TextChecker
Attributes
file_path[RW]
@return [String]
text[RW]
@return [String]
Public Instance Methods
call(file_path, text, compilation_context)
click to toggle source
@param [String] file_path
@param [String] text @param [CompilationContext] compilation_context
@return nil
# File lib/epuber/checker/text_checker.rb, line 45 def call(file_path, text, compilation_context) @file_path = file_path @text = text @block.call(self, text, compilation_context) @text = nil @file_path = nil end
error(message, location: nil)
click to toggle source
Calls superclass method
Epuber::Checker#error
# File lib/epuber/checker/text_checker.rb, line 68 def error(message, location: nil) super(message, location: location || Config.instance.pretty_path_from_project(file_path)) end
should_not_contain(regexp, message)
click to toggle source
@param [Regexp] regexp @param [String] message message to display, when the regexp found something
# File lib/epuber/checker/text_checker.rb, line 58 def should_not_contain(regexp, message) # find all matches # taken from http://stackoverflow.com/questions/6804557/how-do-i-get-the-match-data-for-all-occurrences-of-a-ruby-regular-expression-in matches = text.to_enum(:scan, regexp).map { Regexp.last_match } matches.each do |match| # @type match [MatchData] UI.warning MatchProblem.new(match, message, Config.instance.pretty_path_from_project(file_path)) end end
warning(message, location: nil)
click to toggle source
Calls superclass method
Epuber::Checker#warning
# File lib/epuber/checker/text_checker.rb, line 72 def warning(message, location: nil) super(message, location: location || Config.instance.pretty_path_from_project(file_path)) end