Module: ClassCount
- Defined in:
- lib/jscop/class_count.rb
Class Method Summary collapse
Class Method Details
.class_count(file) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jscop/class_count.rb', line 17 def self.class_count(file) pat = /(class)/ commented_line = %r{^\W+[\/\/]} lines_with_class = [] err_type = 'CLASS_COUNT_ERR' file.lines.each { |line| needed_lines_with_class = pat.match?(line.content) && !line.content.match?(commented_line) lines_with_class << line.number if needed_lines_with_class } raise_err(lines_with_class, err_type, file.filename) if lines_with_class.length > 1 lines_with_class end |
.class_count_res(error_bin, path) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/jscop/class_count.rb', line 4 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 |