Class: Linkage::ResultSets::CSV
- Inherits:
-
Linkage::ResultSet
- Object
- Linkage::ResultSet
- Linkage::ResultSets::CSV
- Defined in:
- lib/linkage/result_sets/csv.rb
Overview
ResultSets::CSV is a subclass of ResultSet that makes it convenient to set up a ScoreSets::CSV and MatchSets::CSV at the same time. For example:
result_set = Linkage::ResultSets::CSV.new('/some/path')
Or by using ResultSet.[]:
result_set = Linkage::ResultSet['csv'].new('/some/path')
ResultSets::CSV.new takes either a directory name as its
argument or a Hash of options. Passing in a directory name is equivalent
to passing in a Hash with the :dir key. For example:
result_set = Linkage::ResultSet['csv'].new('/some/path')
is the same as:
result_set = Linkage::ResultSet['csv'].new({:dir => '/some/path'})
The :dir option lets you specify the parent directory for the score set
and result set files (which are scores.csv and results.csv by default).
The only other relevant option is :overwrite, which controls whether or
not overwriting existing files is permitted.
Instance Method Summary collapse
-
#initialize(dir_or_options = nil) ⇒ CSV
constructor
A new instance of CSV.
- #match_set ⇒ Object
- #score_set ⇒ Object
Methods inherited from Linkage::ResultSet
Constructor Details
#initialize(dir) ⇒ CSV #initialize(options) ⇒ CSV
Returns a new instance of CSV.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/linkage/result_sets/csv.rb', line 47 def initialize( = nil) @options = case when nil {} when String {:dir => } when Hash else raise ArgumentError, "expected nil, a String, or a Hash, got #{.class}" end end |
Instance Method Details
#match_set ⇒ Object
65 66 67 |
# File 'lib/linkage/result_sets/csv.rb', line 65 def match_set @match_set ||= MatchSet['csv'].new(@options) end |
#score_set ⇒ Object
61 62 63 |
# File 'lib/linkage/result_sets/csv.rb', line 61 def score_set @score_set ||= ScoreSet['csv'].new(@options) end |