Class: TextDataTools::Named::DataFile

Inherits:
DataFileBase show all
Defined in:
lib/text-data-tools.rb

Overview

This is a simple class which can interface with the methods of TextDataTools::Named to prevent the user having to specify the file name and other properties of the data file for every call. In a nutshell, create a new instance of this class giving it the filename, and any appropriate options, then call methods from TextDataTools omitting the appropriate arguments.

Instance Method Summary collapse

Methods inherited from DataFileBase

#exists?, #to_s, #view

Constructor Details

#initialize(filename, sep = ':') ⇒ DataFile

Returns a new instance of DataFile.



240
241
242
243
244
# File 'lib/text-data-tools.rb', line 240

def initialize(filename, sep = ':')
	@filename = filename
	@sep = sep
	self
end

Instance Method Details

#get_variable_value(name) ⇒ Object



248
249
250
# File 'lib/text-data-tools.rb', line 248

def get_variable_value(name)
	TextDataTools::Named.get_variable_value(@filename, name, @sep)
end

#inspectObject



245
246
247
# File 'lib/text-data-tools.rb', line 245

def inspect
	"#{self.class}.new(#{@filename.inspect}, #{@sep.inspect})"
end