lib/codependency/node.rb in codependency-0.3.0 vs lib/codependency/node.rb in codependency-0.3.1
- old
+ new
@@ -1,7 +1,5 @@
-require 'pathname'
-
module Codependency
class Node
def initialize( filename, parser )
raise Errno::ENOENT, filename unless File.exist?( filename )
@filename = filename
@@ -12,31 +10,17 @@
##
# all of this node's edges
def edges
@edges ||= begin
parser.parse( filename ).map do |f|
- dirname.join( "#{f}#{extname}" ).to_s
+ "#{f}#{File.extname( filename )}"
end
end
end
##
# a string representing this node's edges, formatted for `tsort`.
def dependencies
edges.map { |edge| [ filename, edge ] }.flatten.join ' '
- end
-
- protected
-
- def dirname
- path.dirname
- end
-
- def extname
- path.extname
- end
-
- def path
- @path ||= Pathname.new filename
end
end
end