Class: Nginxtra::Status
- Inherits:
-
Object
- Object
- Nginxtra::Status
- Defined in:
- lib/nginxtra/status.rb
Overview
The status class encapsulates current state of nginxtra, such as when the last time nginx was compiled and with what options.
Constant Summary collapse
- FILENAME =
The name of the file that stores the state.
".nginxtra_status".freeze
Class Attribute Summary collapse
-
.status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
-
.[](option) ⇒ Object
Retrieve an option from the state stored in the filesystem.
-
.[]=(option, value) ⇒ Object
Store an option to the status state.
Class Attribute Details
.status ⇒ Object
Returns the value of attribute status.
11 12 13 |
# File 'lib/nginxtra/status.rb', line 11 def status @status end |
Class Method Details
.[](option) ⇒ Object
Retrieve an option from the state stored in the filesystem. This will first load the state from the .nginxtra_status file in the root of the nginxtra gem directory, if it has not yet been loaded.
18 19 20 21 |
# File 'lib/nginxtra/status.rb', line 18 def[](option) load! status[option] end |
.[]=(option, value) ⇒ Object
Store an option to the status state. This will save out to the filesystem immediately after storing this option. The return value will be the value stored to the given option key.
26 27 28 29 30 31 |
# File 'lib/nginxtra/status.rb', line 26 def[]=(option, value) load! status[option] = value save! value end |