Class: SourceFile

Inherits:
Object
  • Object
show all
Includes:
FileSystemEntity
Defined in:
lib/exegesis/source_file.rb

Overview

class SourceFile

HAS_A Extension
HAS_A Path
HAS_A Base Name
HAS_MANY SourceFiles (Dependencies)

Responsibilities:

Represents a sourcefile on disk, providing access to it's file-system
related information as well as internal information based on the language.

Notes:

This will likely work w/ an inheritance heirarchy for each programming
language. Mostly it will be one-level deep, but in the case where a
subsequent language forms a superset/subset, deeper inheritance may occur
(similarly we might have a module for shared subsets, etc).

Collaborators:

SourceFile
SourceFileFactory       -- to build the appropriate subclass based on file extenstion

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



27
28
29
# File 'lib/exegesis/source_file.rb', line 27

def dependencies
  @dependencies
end

Instance Method Details

#contentObject



23
24
25
# File 'lib/exegesis/source_file.rb', line 23

def content
  fs_interface.read(path)
end

#depends_on(file) ⇒ Object

Raises:



28
29
30
31
# File 'lib/exegesis/source_file.rb', line 28

def depends_on(file)
  raise InvalidDependency unless file.is_a?(SourceFile)
  @dependencies << file
end