Class: Libevent::Builder
- Inherits:
-
Object
- Object
- Libevent::Builder
- Defined in:
- lib/libevent/builder.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
-
#dispatch ⇒ Object
Start event base loop.
-
#initialize(options = {}, &block) ⇒ Builder
constructor
A new instance of Builder.
-
#server(host, port) {|http| ... } ⇒ Http
Create new Http instance, bind socket and options yield http object.
-
#signal(name, &block) ⇒ Object
Trap signal using event base.
Constructor Details
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
8 9 10 |
# File 'lib/libevent/builder.rb', line 8 def base @base end |
Instance Method Details
#dispatch ⇒ Object
Start event base loop
28 29 30 |
# File 'lib/libevent/builder.rb', line 28 def dispatch base.dispatch end |
#server(host, port) {|http| ... } ⇒ Http
Create new Http instance, bind socket and options yield http object
14 15 16 17 18 19 |
# File 'lib/libevent/builder.rb', line 14 def server(host, port, &block) http = Http.new(@base) http.bind_socket(host, port) or raise RuntimeError, "can't bind socket #{host}:#{port}" yield(http) if block_given? http end |
#signal(name, &block) ⇒ Object
Trap signal using event base
23 24 25 |
# File 'lib/libevent/builder.rb', line 23 def signal(name, &block) base.trap_signal(name, &block) end |