class Tanker::CTanker::CFuture
Public Class Methods
new(ptr, proc = nil, &block)
click to toggle source
Calls superclass method
# File lib/tanker/c_tanker/c_future.rb, line 15 def initialize(ptr, proc = nil, &block) super @cfuture = ptr end
release(ptr)
click to toggle source
# File lib/tanker/c_tanker/c_future.rb, line 20 def self.release(ptr) CTanker.tanker_future_destroy ptr end
Public Instance Methods
get()
click to toggle source
# File lib/tanker/c_tanker/c_future.rb, line 24 def get CTanker.tanker_future_wait @cfuture if CTanker.tanker_future_has_error @cfuture cerr = CTanker.tanker_future_get_error @cfuture raise Error.from_ctanker_error(cerr) else CTanker.tanker_future_get_voidptr @cfuture end end
get_maybe_string()
click to toggle source
# File lib/tanker/c_tanker/c_future.rb, line 41 def get_maybe_string # rubocop:disable Naming/AccessorMethodName (this is not a getter) str_ptr = get if str_ptr.null? nil else str = str_ptr.get_string(0).force_encoding(Encoding::UTF_8) CTanker.tanker_free_buffer str_ptr str end end
get_string()
click to toggle source
# File lib/tanker/c_tanker/c_future.rb, line 34 def get_string # rubocop:disable Naming/AccessorMethodName (this is not a getter) str_ptr = get str = str_ptr.get_string(0).force_encoding(Encoding::UTF_8) CTanker.tanker_free_buffer str_ptr str end