class Qpid::Proton::Selectable
Selectable enables accessing the underlying file descriptors for Messenger.
Public Instance Methods
capacity()
click to toggle source
The number of bytes the selectable is capable of consuming.
# File lib/qpid_proton/selectable.rb, line 56 def capacity Cproton.pn_selectable_capacity(@impl) end
deadline()
click to toggle source
The future expiry time at which control will be returned to the selectable.
# File lib/qpid_proton/selectable.rb, line 69 def deadline tstamp = Cproton.pn_selectable_deadline(@impl) tstamp.nil? ? nil : tstamp / 1000 end
expired?()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 82 def expired? Cproton.pn_selectable_expired(@impl) end
fileno()
click to toggle source
Returns the underlying file descriptor.
This can be used in conjunction with the IO class.
# File lib/qpid_proton/selectable.rb, line 46 def fileno Cproton.pn_selectable_fd(@impl) end
free()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 103 def free return if @freed @freed = true @messenger.unregister_selectable(fileno) @io.close unless @io.nil? Cproton.pn_selectable_free(@impl) @impl = nil end
pending()
click to toggle source
The number of bytes waiting to be written to the file descriptor.
# File lib/qpid_proton/selectable.rb, line 62 def pending Cproton.pn_selectable_pending(@impl) end
readable()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 74 def readable Cproton.pn_selectable_readable(@impl) end
registered=(registered)
click to toggle source
# File lib/qpid_proton/selectable.rb, line 86 def registered=(registered) Cproton.pn_selectable_set_registered(@impl, registered) end
registered?()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 90 def registered? Cproton.pn_selectable_is_registered(@impl) end
terminal?()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 94 def terminal? return true if @impl.nil? Cproton.pn_selectable_is_terminal(@impl) end
to_io()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 50 def to_io @io ||= IO.new(fileno) end
to_s()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 99 def to_s "fileno=#{self.fileno} registered=#{self.registered?} terminal=#{self.terminal?}" end
writable()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 78 def writable Cproton.pn_selectable_writable(@impl) end
Private Instance Methods
check_is_initialized()
click to toggle source
# File lib/qpid_proton/selectable.rb, line 118 def check_is_initialized raise RuntimeError.new("selectable freed") if @impl.nil? end