Class: SyntaxTree::Index::FileComments::FileSource

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/index.rb

Overview

This represents the Ruby source in the form of a file. When it needs to be read we’ll read the file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ FileSource

Returns a new instance of FileSource.



92
93
94
# File 'lib/syntax_tree/index.rb', line 92

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



90
91
92
# File 'lib/syntax_tree/index.rb', line 90

def filepath
  @filepath
end

Instance Method Details

#sourceObject



96
97
98
# File 'lib/syntax_tree/index.rb', line 96

def source
  File.read(filepath)
end