lib/codependency/parser.rb in codependency-0.1.0 vs lib/codependency/parser.rb in codependency-0.2.0

- old
+ new

@@ -1,16 +1,21 @@ 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 ||= /^# require (.+)$/ + @pattern ||= /^#{@comment} require (.+)$/ end end end