class XfOOrth::FileSource

The FileSource class used to extract fOOrth source code from a string.

Public Class Methods

new(name) click to toggle source

Initialize from a file name.
Parameters:

  • name - The name of the file with the fOOrth source code.

Calls superclass method XfOOrth::AbstractSource::new
# File lib/fOOrth/compiler/source/file_source.rb, line 13
def initialize(name)
  @name      = name
  @file      = File.new(name, "r")
  @read_step = @file.each_line
  super()
end

Public Instance Methods

close() click to toggle source

Close the file

Calls superclass method XfOOrth::AbstractSource#close
# File lib/fOOrth/compiler/source/file_source.rb, line 21
def close
  @file.close
  super()
end
file_name() click to toggle source

Get the name of the file

# File lib/fOOrth/compiler/source/file_source.rb, line 32
def file_name
  File.absolute_path(@name)
end
source_name() click to toggle source

What is the source of this text?

# File lib/fOOrth/compiler/source/file_source.rb, line 27
def source_name
  "A file: #{@name}"
end