Class: Fpmache::File

Inherits:
Object
  • Object
show all
Defined in:
lib/fpmache/file.rb

Overview

Process single INI file and return section contents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inifile) ⇒ File

Returns a new instance of File.



7
8
9
10
# File 'lib/fpmache/file.rb', line 7

def initialize(inifile)
  @inifile = inifile
  @contents = {}
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



6
7
8
# File 'lib/fpmache/file.rb', line 6

def contents
  @contents
end

#inifileObject

Returns the value of attribute inifile.



6
7
8
# File 'lib/fpmache/file.rb', line 6

def inifile
  @inifile
end

Instance Method Details

#readObject

Public - Read the INI file and return the processed Hash. Usually, there would be one section per file for PHP-FPM configuraiton file

Returns Hash



16
17
18
19
20
21
# File 'lib/fpmache/file.rb', line 16

def read
  ini = IniFile.load(@inifile)

  section = process_sections(ini)
  ini[section]
end