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