lib/codependency/parser.rb in codependency-0.3.1 vs lib/codependency/parser.rb in codependency-1.0.0
- old
+ new
@@ -2,17 +2,19 @@
class Parser
def initialize( options={} )
@options = options
@comment = options.delete( :comment ) || '#'
+ @dirname = options.delete( :dirname ) || '.'
+ @extname = options.delete( :extname ) || '.rb'
end
##
# determines a file's dependencies based on the configured comment pattern.
def parse( file )
IO.readlines( file ).take_while do |line|
line =~ pattern
- end.map { |line| line[ pattern, 1 ] }
+ end.map { |line| "#{@dirname}/#{line[ pattern, 1 ]}#{@extname}" }
end
protected
##