class Qpid::Proton::Selectable

Selectable enables accessing the underlying file descriptors for Messenger.

@private

Constants

DEFAULT
PROTON_METHOD_PREFIX

@private

Public Class Methods

new(impl) click to toggle source

@private

# File lib/core/selectable.rb, line 71
def initialize(impl)
  @impl = impl
  self.class.store_instance(self, :pn_selectable_attachments)
end
wrap(impl) click to toggle source

@private

# File lib/core/selectable.rb, line 61
def self.wrap(impl)
  return nil if impl.nil?

  self.fetch_instance(impl, :pn_selectable_attachments) || Selectable.new(impl)
end

Public Instance Methods

deadline() click to toggle source
# File lib/core/selectable.rb, line 114
def deadline
  tstamp = Cproton.pn_selectable_get_deadline(@impl)
  return nil if tstamp.nil?
  mills_to_sec(tstamp)
end
deadline=(deadline) click to toggle source
# File lib/core/selectable.rb, line 120
def deadline=(deadline)
  Cproton.pn_selectable_set_deadline(sec_to_millis(deadline))
end
fileno() click to toggle source

Returns the underlying file descriptor.

This can be used in conjunction with the IO class.

# File lib/core/selectable.rb, line 38
def fileno
  Cproton.pn_selectable_get_fd(@impl)
end
reading=(reading) click to toggle source
# File lib/core/selectable.rb, line 92
def reading=(reading)
  if reading.nil?
    reading = false
  elsif reading == "0"
    reading = false
  else
    reading = true
  end
  Cproton.pn_selectable_set_reading(@impl, reading ? true : false)
end
to_io() click to toggle source
# File lib/core/selectable.rb, line 124
def to_io
  @io ||= IO.new(fileno)
end
writing=(writing) click to toggle source
# File lib/core/selectable.rb, line 103
def writing=(writing)
  if writing.nil?
    writing = false
  elsif writing == "0"
    writing = false
  else
    writing = true
  end
  Cproton.pn_selectable_set_writing(@impl, writing ? true : false)
end