Class: Datafile::Dataset
- Inherits:
-
Object
- Object
- Datafile::Dataset
- Includes:
- LogUtils::Logging
- Defined in:
- lib/datafile/datasets/dataset.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#file? ⇒ Boolean
note: use file? (not exit? might use zip? later to check if zip exists? -why? why not?).
-
#initialize(name, opts = {}) ⇒ Dataset
constructor
A new instance of Dataset.
- #setup ⇒ Object
Constructor Details
#initialize(name, opts = {}) ⇒ Dataset
Returns a new instance of Dataset.
25 26 27 28 |
# File 'lib/datafile/datasets/dataset.rb', line 25 def initialize( name, opts={} ) @name = name @opts = opts end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/datafile/datasets/dataset.rb', line 30 def name @name end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
31 32 33 |
# File 'lib/datafile/datasets/dataset.rb', line 31 def opts @opts end |
Instance Method Details
#file? ⇒ Boolean
note: use file? (not exit? might use zip? later to check if zip exists? -why? why not?)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/datafile/datasets/dataset.rb', line 38 def file? # note: use file? (not exit? might use zip? later to check if zip exists? -why? why not?) ## hack/convenience shortcut: ## 1) check if dataset exists as local (in situ) file dataset ## e.g. working folder == name of dataset ## ## todo/fix: 2) also check ## via (file)registry - why, why not?? ## split name in org/user + project (e.g. openfootball/at-austria) parts = @name.split( '/' ) basename = parts[1] ## e.g. ## ./ (working folder) => at-austria ## openfootball/at-austria if File.basename( Dir.getwd ) == basename puts " bingo!! working folder >#{basename}< matches dataset" true ## return true else false ## return false end end |
#setup ⇒ Object
33 34 35 36 |
# File 'lib/datafile/datasets/dataset.rb', line 33 def setup value = @opts[:setup] || 'all' "setups/#{value}" end |