Class: Puma::StateFile

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/state_file.rb

Constant Summary collapse

FIELDS =
%w!control_url control_auth_token pid running_from!

Instance Method Summary collapse

Constructor Details

#initializeStateFile

Returns a new instance of StateFile.


7
8
9
# File 'lib/puma/state_file.rb', line 7

def initialize
  @options = {}
end

Instance Method Details

#load(path) ⇒ Object


18
19
20
# File 'lib/puma/state_file.rb', line 18

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

#save(path, permission = nil) ⇒ Object


11
12
13
14
15
16
# File 'lib/puma/state_file.rb', line 11

def save(path, permission = nil)
  File.open(path, "w") do |file|
    file.chmod(permission) if permission
    file.write(YAML.dump(@options))
  end
end