lib/codependency/node.rb in codependency-0.1.0 vs lib/codependency/node.rb in codependency-0.2.0
- old
+ new
@@ -1,14 +1,15 @@
require 'pathname'
module Codependency
class Node
- def initialize( filename )
- raise Errno::ENOENT unless File.exist?( filename )
+ def initialize( filename, parser )
+ raise Errno::ENOENT, filename unless File.exist?( filename )
@filename = filename
+ @parser = parser
end
- attr_reader :filename
+ attr_reader :filename, :parser
def dependencies
parser.parse( filename ).map { |f| dirname.join( "#{f}#{extname}" ).to_s }
end
@@ -22,12 +23,8 @@
path.extname
end
def path
@path ||= Pathname.new filename
- end
-
- def parser
- @parser ||= Parser.new
end
end
end