Class: CurrentCostDaemon::Publishers::Http
- Inherits:
-
Object
- Object
- CurrentCostDaemon::Publishers::Http
- Defined in:
- lib/currentcostd/publishers/http.rb
Defined Under Namespace
Classes: Servlet
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config) ⇒ Http
constructor
A new instance of Http.
- #update(reading) ⇒ Object
Constructor Details
#initialize(config) ⇒ Http
Returns a new instance of Http.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/currentcostd/publishers/http.rb', line 93 def initialize(config) # Initialise storage @watts = 0 # Create WEBrick server @server = WEBrick::HTTPServer.new(:Port => config['http']['port'] ) # Create a simple webrick servlet for HTML output @server.mount("/", Servlet) trap("INT") {@server.shutdown} Thread.new{@server.start} end |
Class Method Details
.config_section ⇒ Object
31 32 33 |
# File 'lib/currentcostd/publishers/http.rb', line 31 def self.config_section 'http' end |