Sha256: 6f403c31cc8a7e6a8dc9b0ac629833d4b6e188ccfc1cbaac2388b85b49c55da6

Contents?: true

Size: 539 Bytes

Versions: 1

Compression:

Stored size: 539 Bytes

Contents

require 'pathname'

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

    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

    def parser
      @parser ||= Parser.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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