Class: HttpParser::Parser::DataCallback
- Inherits:
-
FFI::Function
- Object
- FFI::Function
- HttpParser::Parser::DataCallback
- Defined in:
- lib/http-parser/parser.rb
Class Method Summary collapse
Class Method Details
.new(&block) ⇒ Object
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/http-parser/parser.rb', line 212 def self.new(&block) super(:int, [::HttpParser::Instance.ptr, :pointer, :size_t]) do |parser, buffer, length| begin data = buffer.get_bytes(0, length) catch(:return) { yield(parser, data); 0 } rescue -1 end end end |