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.



118
119
120
# File 'lib/syntax_tree/index.rb', line 118

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



116
117
118
# File 'lib/syntax_tree/index.rb', line 116

def filepath
  @filepath
end

Instance Method Details

#sourceObject



122
123
124
# File 'lib/syntax_tree/index.rb', line 122

def source
  File.read(filepath)
end