Class: RubDev::Enumerate

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

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Enumerate

Returns a new instance of Enumerate.

Raises:

  • (ArgumentError)


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

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

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

Instance Method Details

#contextObject



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

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

#match_initializedObject



79
80
81
# File 'lib/rubdev/enumerate.rb', line 79

def match_initialized
  !RubDev::C.udev_enumerate_add_match_is_initialized(@pointer).zero?
end

#match_parent(parent) ⇒ Object



73
74
75
# File 'lib/rubdev/enumerate.rb', line 73

def match_parent (parent)
  !RubDev::C.udev_enumerate_add_match_parent(@pointer, parent).zero?
end

#match_property(property, value) ⇒ Object



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

def match_property (property, value)
  !RubDev::C.udev_enumerate_add_match_property(@pointer, property, value).zero?
end

#match_subsystem(subsystem) ⇒ Object



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

def match_subsystem (subsystem)
  !RubDev::C.udev_enumerate_add_match_subsystem(@pointer, subsystem).zero?
end

#match_sysattr(sysattr, value) ⇒ Object



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

def match_sysattr (sysattr, value)
  !RubDev::C.udev_enumerate_add_match_sysattr(@pointer, sysattr, value).zero?
end

#match_sysname(sysname) ⇒ Object



84
85
86
# File 'lib/rubdev/enumerate.rb', line 84

def match_sysname (sysname)
  !RubDev::C.udev_enumerate_add_match_sysname(@pointer, sysname).zero?
end

#match_tag(tag) ⇒ Object



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

def match_tag (tag)
  !RubDev::C.udev_enumerate_add_match_tag(@pointer, tag).zero?
end

#nomatch_subsystem(subsystem) ⇒ Object



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

def nomatch_subsystem (subsystem)
  !RubDev::C.udev_enumerate_add_nomatch_subsystem(@pointer, subsystem).zero?
end

#nomatch_sysattr(sysattr, value) ⇒ Object



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

def nomatch_sysattr (sysattr, value)
  !RubDev::C.udev_enumerate_add_nomatch_sysattr(@pointer, sysattr, value).zero?
end

#refObject



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

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

#scan_devicesObject



92
93
94
# File 'lib/rubdev/enumerate.rb', line 92

def scan_devices
  !RubDev::C.udev_enumerate_scan_devices(@pointer).zero?
end

#scan_subsystemsObject



96
97
98
# File 'lib/rubdev/enumerate.rb', line 96

def scan_subsystems
  !RubDev::C.udev_enumerate_scan_subsystems(@pointer).zero?
end

#syspath=(syspath) ⇒ Object



88
89
90
# File 'lib/rubdev/enumerate.rb', line 88

def syspath= (syspath)
  !RubDev::C.udev_enumerate_add_syspath(syspath).zero?
end

#to_listObject



100
101
102
# File 'lib/rubdev/enumerate.rb', line 100

def to_list
  List.new(RubDev::C.udev_enumerate_get_list_entry(@pointer))
end

#unrefObject



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

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