Sha256: 4d4abd800cc986df8fd44eabaa32d65ff62803d26ac0b4872cc9a2486ef3eae7
Contents?: true
Size: 761 Bytes
Versions: 2
Compression:
Stored size: 761 Bytes
Contents
require_relative '../classes/error' module ClassCount def self.class_count_res(error_bin, path) lines_with_class_def = class_count(path) error_bin << lines_with_class_def if lines_with_class_def.length > 1 error_bin end private_class_method def self.raise_err(line, message, path) error = Error.new(line, message, path) class_count_err = error.print_err(line, message, path) if error class_count_err end def self.class_count(file) pat = /(class)/ lines_with_class = [] err_type = 'CLASS_COUNT_ERR' file.lines.each { |line| lines_with_class << line.number if pat.match?(line.content) } raise_err(lines_with_class, err_type, file.filename) if lines_with_class.length > 1 lines_with_class end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jscop-0.1.3 | lib/jscop/class_count.rb |
jscop-0.1.2 | lib/jscop/class_count.rb |