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


20
21
22
# File 'lib/puma/state_file.rb', line 20

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

#save(path, permission = nil) ⇒ Object


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

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