Sha256: 0d5629950954eb92d539a8ebbb854d95f3776719ee37e4a4aae5f49ec0bbff98

Contents?: true

Size: 543 Bytes

Versions: 11

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

require 'yaml'
require 'fileutils'

# module to read sketch.yml
# and or create sketch.yml with default parameters
module Parameters
  PATH = File.join(ENV['HOME'], '.picrate').freeze
  FILE = File.join(PATH, 'sketch.yml').freeze
  PARAM = { 'sketch' =>
    { 'width' => 640, 'height' => 480, 'mode' => 'P2D' } }.freeze

    def self.write
      FileUtils.mkdir_p PATH
      File.write(FILE, PARAM.to_yaml)
    end

    def self.read
      write unless File.exist?(FILE)
      YAML.load_file(FILE)
    end
  end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
picrate-1.3.0-java lib/picrate/creators/parameters.rb
picrate-1.2.4-java lib/picrate/creators/parameters.rb
picrate-1.2.3-java lib/picrate/creators/parameters.rb
picrate-1.2.2-java lib/picrate/creators/parameters.rb
picrate-1.2.1-java lib/picrate/creators/parameters.rb
picrate-1.2.0-java lib/picrate/creators/parameters.rb
picrate-1.1.0-java lib/picrate/creators/parameters.rb
picrate-1.0.0-java lib/picrate/creators/parameters.rb
picrate-0.9.0-java lib/picrate/creators/parameters.rb
picrate-0.8.0-java lib/picrate/creators/parameters.rb
picrate-0.7.0-java lib/picrate/creators/parameters.rb