Class: RedisRing::WebInterfaceRunner
- Inherits:
-
Object
- Object
- RedisRing::WebInterfaceRunner
- Includes:
- BackgroundThread
- Defined in:
- lib/redis_ring/web_interface.rb
Instance Attribute Summary collapse
-
#master ⇒ Object
readonly
Returns the value of attribute master.
-
#slave ⇒ Object
readonly
Returns the value of attribute slave.
Instance Method Summary collapse
- #do_work ⇒ Object
- #halt ⇒ Object
-
#initialize(port, master, slave) ⇒ WebInterfaceRunner
constructor
A new instance of WebInterfaceRunner.
Methods included from BackgroundThread
#after_halt, #before_run, #continue_running?, #run
Constructor Details
#initialize(port, master, slave) ⇒ WebInterfaceRunner
Returns a new instance of WebInterfaceRunner.
9 10 11 12 13 |
# File 'lib/redis_ring/web_interface.rb', line 9 def initialize(port, master, slave) @port = port @master = master @slave = slave end |
Instance Attribute Details
#master ⇒ Object (readonly)
Returns the value of attribute master.
7 8 9 |
# File 'lib/redis_ring/web_interface.rb', line 7 def master @master end |
#slave ⇒ Object (readonly)
Returns the value of attribute slave.
7 8 9 |
# File 'lib/redis_ring/web_interface.rb', line 7 def slave @slave end |
Instance Method Details
#do_work ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/redis_ring/web_interface.rb', line 15 def do_work handler = Rack::Handler.get("webrick") handler.run(WebInterface, :Port => @port, :master => @master, :slave => @slave) do |server| @server = server WebInterface.set :master, master WebInterface.set :slave, slave WebInterface.set :running, true end end |
#halt ⇒ Object
25 26 27 28 |
# File 'lib/redis_ring/web_interface.rb', line 25 def halt super @server.stop if @server end |