Class: DatasetSource

Inherits:
Object
  • Object
show all
Defined in:
lib/kaba/dataset_source.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DatasetSource

Returns a new instance of DatasetSource.



4
5
6
# File 'lib/kaba/dataset_source.rb', line 4

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/kaba/dataset_source.rb', line 3

def path
  @path
end

Class Method Details

.podfileObject



31
32
33
34
35
36
37
# File 'lib/kaba/dataset_source.rb', line 31

def podfile
  d_podfile_path = File.join(Dir.pwd, 'DPodfile.rb')
  unless File.exist?(d_podfile_path)
    FileUtils.cp(File.join(__dir__, '_DPodfile_'), d_podfile_path)
  end
  d_podfile_path
end

.testfileObject



39
40
41
42
43
44
45
# File 'lib/kaba/dataset_source.rb', line 39

def testfile
  d_testfile_path = File.join(Dir.pwd, 'DTestfile.rb')
  unless File.exist?(d_testfile_path)
    FileUtils.cp(File.join(__dir__, '_DTestfile_'), d_testfile_path)
  end
  d_testfile_path
end

Instance Method Details

#join(name) ⇒ Object



26
27
28
# File 'lib/kaba/dataset_source.rb', line 26

def join(name)
  self.class.new File.join(@path, name)
end

#readObject



14
15
16
# File 'lib/kaba/dataset_source.rb', line 14

def read
  File.read @path
end

#to_pathObject



22
23
24
# File 'lib/kaba/dataset_source.rb', line 22

def to_path
  @path
end

#to_sObject



18
19
20
# File 'lib/kaba/dataset_source.rb', line 18

def to_s
  @path
end