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 file_path
[String] @param text [String] @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
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.print_processing_problem MatchProblem.new(match, message, Config.instance.pretty_path_from_project(file_path)) end end