Sha256: 447e56bae7d45e18eee8b677e4f0300ee6bda204b5b7c6228727b79d32999431
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Appifier module Helpers module Datasets def open_dataset(template:) path = File::expand_path("#{DEFAULT_DATASETS_PATH}/#{template}.yml") raise 'Dataset not found' unless File::exist? path begin return YAML.load_file(path) rescue StandardError => e raise e.message end end def check_dataset_defined?(template:) return File::exist? File::expand_path("#{DEFAULT_DATASETS_PATH}/#{template}.yml") end def write_dataset(template:, data:) path = File::expand_path("#{DEFAULT_DATASETS_PATH}/#{template}.yml") File.open(path, 'w') { |file| file.write(data.to_yaml) } end def open_yaml(filename:) raise 'File not found' unless File::exist? filename begin return YAML.load_file(filename) rescue StandardError => e raise e.message end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
appifier-0.3.0 | lib/appifier/helpers/datasets.rb |
appifier-0.2.0 | lib/appifier/helpers/datasets.rb |
appifier-0.1.2 | lib/appifier/helpers/datasets.rb |