Class: Capsium::Package::DatasetConfig
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Capsium::Package::DatasetConfig
- Defined in:
- lib/capsium/package/storage_config.rb,
sig/capsium/package/storage_config.rbs
Overview
A single dataset entry (ARCHITECTURE.md section 5): schema-backed file (via "source") or SQLite ("databaseFile" + "table").
Constant Summary collapse
- FORMATS =
{ ".yaml" => "yaml", ".yml" => "yaml", ".json" => "json", ".csv" => "csv", ".tsv" => "tsv", ".sqlite" => "sqlite", ".db" => "sqlite" }.freeze
- SCHEMA_TYPES =
%w[json-schema].freeze
Instance Attribute Summary collapse
-
#database_file ⇒ String?
Returns the value of attribute database_file.
-
#schema_file ⇒ String?
Returns the value of attribute schema_file.
-
#schema_type ⇒ String?
Returns the value of attribute schema_type.
-
#source ⇒ String?
Returns the value of attribute source.
-
#table ⇒ String?
Returns the value of attribute table.
Instance Method Summary collapse
- #backing_file ⇒ String
- #format ⇒ String
- #initialize ⇒ Object constructor
- #sqlite? ⇒ Boolean
- #to_dataset(name, package_path) ⇒ Dataset
- #to_hash ⇒ Hash[String, untyped]
- #to_json ⇒ String
Constructor Details
#initialize ⇒ Object
33 |
# File 'sig/capsium/package/storage_config.rbs', line 33
def initialize: (?source: String? source, ?schema_file: String? schema_file,
|
Instance Attribute Details
#database_file ⇒ String?
Returns the value of attribute database_file.
30 31 32 |
# File 'sig/capsium/package/storage_config.rbs', line 30 def database_file @database_file end |
#schema_file ⇒ String?
Returns the value of attribute schema_file.
28 29 30 |
# File 'sig/capsium/package/storage_config.rbs', line 28 def schema_file @schema_file end |
#schema_type ⇒ String?
Returns the value of attribute schema_type.
29 30 31 |
# File 'sig/capsium/package/storage_config.rbs', line 29 def schema_type @schema_type end |
#source ⇒ String?
Returns the value of attribute source.
27 28 29 |
# File 'sig/capsium/package/storage_config.rbs', line 27 def source @source end |
#table ⇒ String?
Returns the value of attribute table.
31 32 33 |
# File 'sig/capsium/package/storage_config.rbs', line 31 def table @table end |
Instance Method Details
#backing_file ⇒ String
43 44 45 |
# File 'lib/capsium/package/storage_config.rb', line 43 def backing_file database_file || source.to_s end |
#format ⇒ String
33 34 35 36 37 |
# File 'lib/capsium/package/storage_config.rb', line 33 def format FORMATS.fetch(File.extname(backing_file).downcase) do raise Error, "Unsupported data file type: #{File.extname(backing_file)}" end end |
#sqlite? ⇒ Boolean
39 40 41 |
# File 'lib/capsium/package/storage_config.rb', line 39 def sqlite? !database_file.nil? end |
#to_dataset(name, package_path) ⇒ Dataset
47 48 49 |
# File 'lib/capsium/package/storage_config.rb', line 47 def to_dataset(name, package_path) Dataset.new(name: name, config: self, package_path: package_path) end |
#to_hash ⇒ Hash[String, untyped]
47 |
# File 'sig/capsium/package/storage_config.rbs', line 47
def to_hash: () -> Hash[String, untyped]
|
#to_json ⇒ String
46 |
# File 'sig/capsium/package/storage_config.rbs', line 46
def to_json: (*untyped args) -> String
|