Sha256: 146a0e99f612c28b76335ca7201a53625902ade8efb7a95fe10ecf2eddcea675

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

require 'yaml'

module Getch
  class States
    def initialize
      @file = File.join('/tmp/install_gentoo.yaml')
      load_state
    end

    def partition
      STATES[:partition] = true
      save
    end

    def format
      STATES[:format] = true
      save
    end

    private

    def save
      File.open(@file, 'w') { |f| YAML::dump(STATES, f) }
    end

    def load_state()
      if File.exists? @file
        state_file = YAML.load_file(@file)
        STATES.merge!(state_file)
      else
        save
        STDERR.puts "Initialize states"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
getch-0.0.2 lib/getch/states.rb