Class: Mrubyc::Test::Config
Class Method Summary collapse
Class Method Details
.read(check: true) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mrubyc/test/config.rb', line 10 def read(check: true) FileUtils.touch('.mrubycconfig') config = YAML.load_file('.mrubycconfig') if check if !config || config == [] || !config['test_dir'] raise 'Check if `.mrubycconfig` exists.' end end config || {} end |
.write(config) ⇒ Object
21 22 23 24 25 |
# File 'lib/mrubyc/test/config.rb', line 21 def write(config) File.open('.mrubycconfig', 'r+') do |file| file.write(config.to_yaml) end end |