Sha256: 52e68c286dc726621d7e2336d1318dfc00380ffb8beac1e4660218ac779882ed

Contents?: true

Size: 398 Bytes

Versions: 1

Compression:

Stored size: 398 Bytes

Contents

module Codependency
  class Parser

    def initialize( options={} )
      @options = options
      @comment = options.delete( :comment ) || '#'
    end

    def parse( file )
      IO.readlines( file ).take_while do |line|
        line =~ pattern
      end.map { |line| line[ pattern, 1 ] }
    end

    protected

    def pattern
      @pattern ||= /^#{@comment} require (.+)$/
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codependency-0.2.0 lib/codependency/parser.rb