Sha256: 07fe9845925d953cfb196f9839baf82192d8fde0aea2997611c2f2d2958524e5
Contents?: true
Size: 839 Bytes
Versions: 74
Compression:
Stored size: 839 Bytes
Contents
class Parser ANYTHINGS = %w[([^\"]*) ([^"]+) ([^"]*) (.*) (.*?) [^"]+ ([^\"]+) ([^']*) ([^\/]*) (.+) (.*[^:]) (.+?) .+].map &Regexp.method(:escape) def self.human_regex(regex) regex. sub(/^\(?\/\^?/, ''). # Strip Regex beginning sub(/\$?\/\)?$/, ''). # Strip Regex end gsub(' ?', ' '). gsub('(?:|I )', 'I '). gsub('(?:', '('). gsub(Regexp.new(Regexp.escape '(\d+)(st|nd|rd|th)'), '<nth>'). gsub(Regexp.new(ANYTHINGS.join '|'), '...'). gsub(/\\\//, '/') end def self.format_comment(comment) comment.gsub! /.*coding:.*UTF-8.*/, '' comment.strip! comment_lines = comment.split("\n").take_while { |line| line =~ /^\s*#/ } formatted = comment_lines && comment_lines.join("\n").gsub(/^\s*# ?/, '') formatted if formatted and not formatted.empty? end end
Version data entries
74 entries across 74 versions & 1 rubygems