Sha256: d3fd53a651c5bd991b283bc95a51c6816ad122aea3a42c3f9439c738489f39c4

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

require_relative './line'

class JsParser
  attr_reader :filename, :lines

  def initialize(filename)
    @filename = filename
    @lines = []
    set_lines
  end

  def set_lines
    file = File.open(@filename)
    all_lines = file.readlines.map(&:chomp)
    init_lines = lambda { |val, index|
      line = Line.new(index + 1, val, @filename)
      @lines << line if !line.filename.match?(/(node_modules)/)
    }

    all_lines.each_with_index(&init_lines)
    file.close
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jscop-0.1.7 lib/classes/js_parser.rb