Class: Edaemon::Server
- Inherits:
-
Object
- Object
- Edaemon::Server
- Defined in:
- lib/edaemon/server.rb
Constant Summary collapse
- PID_FILE_PATH =
'./edaemon.pid'- LOG_FILE_PATH =
'./edaemon.log'- STARTED =
:started- STOPPED =
:stopped- Error =
Class.new(StandardError)
- ApplicationAllreadyRunnedError =
Class.new(Error)
- BlockNotSettedError =
Class.new(Error)
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Instance Method Summary collapse
-
#initialize(block: nil) ⇒ Server
constructor
A new instance of Server.
-
#start ⇒ Object
TODO: Конфиг лога TODO: Конфиг пид файла.
- #status ⇒ Object
Constructor Details
#initialize(block: nil) ⇒ Server
14 15 16 |
# File 'lib/edaemon/server.rb', line 14 def initialize(block: nil) @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
34 35 36 |
# File 'lib/edaemon/server.rb', line 34 def block @block end |
Instance Method Details
#start ⇒ Object
TODO: Конфиг лога TODO: Конфиг пид файла
20 21 22 23 24 25 26 27 28 |
# File 'lib/edaemon/server.rb', line 20 def start # TODO: simplecov raise почему не подсвечивается raise ApplicationAllreadyRunnedError if status == STARTED raise BlockNotSettedError unless block pid = fork_block! save_pid!(pid: pid) pid end |
#status ⇒ Object
30 31 32 |
# File 'lib/edaemon/server.rb', line 30 def status pid_runned?(pid: saved_pid) ? STARTED : STOPPED end |