Sha256: cc266e189fda0562e773b505d5748e4c90a9da99e6050c195126401d7d7d256e

Contents?: true

Size: 672 Bytes

Versions: 32

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

require 'yaml'

module Puma
  class StateFile
    def initialize
      @options = {}
    end

    def save(path, permission = nil)
      contents =YAML.dump @options
      if permission
        File.write path, contents, mode: 'wb:UTF-8'
      else
        File.write path, contents, mode: 'wb:UTF-8', perm: permission
      end
    end

    def load(path)
      @options = YAML.load File.read(path)
    end

    FIELDS = %w!control_url control_auth_token pid running_from!

    FIELDS.each do |f|
      define_method f do
        @options[f]
      end

      define_method "#{f}=" do |v|
        @options[f] = v
      end
    end
  end
end

Version data entries

32 entries across 29 versions & 4 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/puma-5.5.2/lib/puma/state_file.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/puma-5.5.2/lib/puma/state_file.rb
puma-5.5.2-java lib/puma/state_file.rb
puma-5.5.2 lib/puma/state_file.rb
puma-5.5.1-java lib/puma/state_file.rb
puma-5.5.1 lib/puma/state_file.rb
puma-5.5.0-java lib/puma/state_file.rb
puma-5.5.0 lib/puma/state_file.rb
piesync-puma-5.4.0.1 lib/puma/state_file.rb
puma-5.4.0-java lib/puma/state_file.rb
puma-5.4.0 lib/puma/state_file.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/puma-5.2.2/lib/puma/state_file.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/puma-5.2.1/lib/puma/state_file.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/puma-5.1.1/lib/puma/state_file.rb
puma-5.3.2-java lib/puma/state_file.rb
puma-5.3.2 lib/puma/state_file.rb
puma-5.3.1-java lib/puma/state_file.rb
puma-5.3.1 lib/puma/state_file.rb
puma-5.3.0-java lib/puma/state_file.rb
puma-5.3.0 lib/puma/state_file.rb