Sha256: 02c2818b05dc7ef624d784fa3b7413f59646555a9c875b6473db29f52ef191e3

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

require 'pathname'

module Codependency
  class Node
    def initialize( filename, parser )
      raise Errno::ENOENT, filename unless File.exist?( filename )
      @filename = filename
      @parser   = parser
    end
    attr_reader :filename, :parser

    def dependencies
      parser.parse( filename ).map { |f| dirname.join( "#{f}#{extname}" ).to_s }
    end

    protected

    def dirname
      path.dirname
    end

    def extname
      path.extname
    end

    def path
      @path ||= Pathname.new filename
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codependency-0.2.0 lib/codependency/node.rb