Class: RubDev::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/rubdev/queue.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Queue

Returns a new instance of Queue.

Raises:

  • (ArgumentError)


42
43
44
45
46
# File 'lib/rubdev/queue.rb', line 42

def initialize (context)
  raise ArgumentError, "argument is NOT a RubDev::Context" unless context.is_a?(Context)

  @pointer = RubDev::C.udev_queue_new(context.to_c)
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/rubdev/queue.rb', line 48

def active?
  !RubDev::C.udev_queue_get_udev_is_active(@pointer).zero?
end

#contextObject



36
37
38
39
40
# File 'lib/rubdev/queue.rb', line 36

def context
  Context.allocate.tap {|i|
    i.instance_variable_set(:@pointer, RubDev::C.udev_queue_get_udev(@pointer))
  }
end

#empty?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/rubdev/queue.rb', line 52

def empty?
  !RubDev::C.udev_queue_get_queue_is_empty(@pointer).zero?
end

#failedObject



68
69
70
# File 'lib/rubdev/queue.rb', line 68

def failed
  List.new(RubDev::C.udev_queue_get_failed_list_entry(@pointer))
end

#kernel_seqnumObject



72
73
74
# File 'lib/rubdev/queue.rb', line 72

def kernel_seqnum
  RubDev::C.udev_queue_get_kernel_seqnum(@pointer)
end

#queuedObject



64
65
66
# File 'lib/rubdev/queue.rb', line 64

def queued
  List.new(RubDev::C.udev_queue_get_queued_list_entry(@pointer))
end

#refObject



26
27
28
29
# File 'lib/rubdev/queue.rb', line 26

def ref
  RubDev::C.udev_queue_ref(@pointer)
  self
end

#seqnum_finished?(seqnum) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/rubdev/queue.rb', line 56

def seqnum_finished? (seqnum)
  !RubDev::C.udev_queue_get_seqnum_is_finished(@pointer, seqnum).zero?
end

#seqnum_sequence_finished?(start, stop) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/rubdev/queue.rb', line 60

def seqnum_sequence_finished? (start, stop)
  !RubDev::C.udev_queue_get_seqnum_sequence_is_finished(@pointer, start, stop).zero?
end

#udev_seqnumObject



76
77
78
# File 'lib/rubdev/queue.rb', line 76

def udev_seqnum
  RubDev::C.udev_queue_get_udev_seqnum(@pointer)
end

#unrefObject



31
32
33
34
# File 'lib/rubdev/queue.rb', line 31

def unref
  RubDev::C.udev_queue_unref(@pointer)
  self
end