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

- old
+ new

@@ -4,17 +4,22 @@ def initialize( options={} ) @options = options @comment = options.delete( :comment ) || '#' 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 protected + ## + # the comment pattern to use. + # TODO allow this to be more configurable def pattern @pattern ||= /^#{@comment} require (.+)$/ end end end