Flowdock
method

add_by_io

Importance_0
Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: CodeStatisticsCalculator
add_by_io(io, file_type) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File railties/lib/rails/code_statistics_calculator.rb, line 47
  def add_by_io(io, file_type)
    patterns = PATTERNS[file_type] || {}

    comment_started = false

    while line = io.gets
      @lines += 1

      if comment_started
        if patterns[:end_block_comment] && line =~ patterns[:end_block_comment]
          comment_started = false
        end
        next
      else
        if patterns[:begin_block_comment] && line =~ patterns[:begin_block_comment]
          comment_started = true
          next
        end
      end

      @classes   += 1 if patterns[:class] && line =~ patterns[:class]
      @methods   += 1 if patterns[:method] && line =~ patterns[:method]
      if line !~ /^\s*$/ && (patterns[:line_comment].nil? || line !~ patterns[:line_comment])
        @code_lines += 1
      end
    end
  end
Register or log in to add new notes.