Class: RailsServerMonitor::ServerSetup
- Inherits:
-
Object
- Object
- RailsServerMonitor::ServerSetup
- Defined in:
- app/services/rails_server_monitor/server_setup.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize ⇒ ServerSetup
constructor
A new instance of ServerSetup.
Constructor Details
#initialize ⇒ ServerSetup
Returns a new instance of ServerSetup.
7 8 9 |
# File 'app/services/rails_server_monitor/server_setup.rb', line 7 def initialize @server = RailsServerMonitor::Server.find_or_initialize_by(hostname: hostname) end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
5 6 7 |
# File 'app/services/rails_server_monitor/server_setup.rb', line 5 def server @server end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/services/rails_server_monitor/server_setup.rb', line 11 def call server.tap do next update_server if server.updated_at.blank? needs_update = (Time.zone.now - server.updated_at) >= config.update_server_interval update_server if needs_update end end |