Class: Capsium::Package::DatasetConfig

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/capsium/package/dataset_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dataset(dataset) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/capsium/package/dataset_config.rb', line 18

def self.from_dataset(dataset)
  new(
    name: dataset.config.name,
    source: dataset.config.source,
    format: dataset.config.format,
    schema: dataset.config.schema,
  )
end

Instance Method Details

#to_dataset(data_path) ⇒ Object



11
12
13
14
15
16
# File 'lib/capsium/package/dataset_config.rb', line 11

def to_dataset(data_path)
  Dataset.new(config: self,
              data_path: File.join(
                File.dirname(data_path), source
              ))
end