Class: Coolio::DSL::ConnectionBuilder
- Inherits:
-
Object
- Object
- Coolio::DSL::ConnectionBuilder
- Defined in:
- lib/cool.io/dsl.rb
Overview
Builder for Cool.io::TCPSocket classes
Instance Method Summary collapse
-
#initialize(klass) ⇒ ConnectionBuilder
constructor
A new instance of ConnectionBuilder.
-
#initializer(&action) ⇒ Object
Declare an initialize function.
-
#on_close(&action) ⇒ Object
Declare the on_close callback.
-
#on_connect(&action) ⇒ Object
Declare the on_connect callback.
-
#on_connect_failed(&action) ⇒ Object
Declare a callback fired if we failed to connect.
-
#on_read(&action) ⇒ Object
Declare the on_read callback.
-
#on_resolve_failed(&action) ⇒ Object
Declare a callback fired if DNS resolution failed.
-
#on_write_complete(&action) ⇒ Object
Declare the on_write_complete callback.
Constructor Details
#initialize(klass) ⇒ ConnectionBuilder
Returns a new instance of ConnectionBuilder.
82 83 84 |
# File 'lib/cool.io/dsl.rb', line 82 def initialize(klass) @klass = klass end |
Instance Method Details
#initializer(&action) ⇒ Object
Declare an initialize function
87 88 89 |
# File 'lib/cool.io/dsl.rb', line 87 def initializer(&action) @klass.send :define_method, :initialize, &action end |
#on_close(&action) ⇒ Object
Declare the on_close callback
107 108 109 |
# File 'lib/cool.io/dsl.rb', line 107 def on_close(&action) @klass.send :define_method, :on_close, &action end |
#on_connect(&action) ⇒ Object
Declare the on_connect callback
92 93 94 |
# File 'lib/cool.io/dsl.rb', line 92 def on_connect(&action) @klass.send :define_method, :on_connect, &action end |
#on_connect_failed(&action) ⇒ Object
Declare a callback fired if we failed to connect
97 98 99 |
# File 'lib/cool.io/dsl.rb', line 97 def on_connect_failed(&action) @klass.send :define_method, :on_connect_failed, &action end |
#on_read(&action) ⇒ Object
Declare the on_read callback
112 113 114 |
# File 'lib/cool.io/dsl.rb', line 112 def on_read(&action) @klass.send :define_method, :on_read, &action end |
#on_resolve_failed(&action) ⇒ Object
Declare a callback fired if DNS resolution failed
102 103 104 |
# File 'lib/cool.io/dsl.rb', line 102 def on_resolve_failed(&action) @klass.send :define_method, :on_resolve_failed, &action end |
#on_write_complete(&action) ⇒ Object
Declare the on_write_complete callback
117 118 119 |
# File 'lib/cool.io/dsl.rb', line 117 def on_write_complete(&action) @klass.send :define_method, :on_write_complete, &action end |