Class: XlibObj::Atom

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display, atom) ⇒ Atom

Returns a new instance of Atom.



11
12
13
14
15
16
17
18
# File 'lib/atom.rb', line 11

def initialize(display, atom)
  @display = display
  @to_native = if atom.is_a? Integer
                 atom
               else
                 Xlib.XInternAtom(@display.to_native, atom.to_s, false)
               end
end

Instance Attribute Details

#to_nativeObject (readonly)

Returns the value of attribute to_native.



20
21
22
# File 'lib/atom.rb', line 20

def to_native
  @to_native
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/atom.rb', line 26

def exists?
  @to_native != 0
end

#nameObject



22
23
24
# File 'lib/atom.rb', line 22

def name
  Xlib.XGetAtomName(@display.to_native, @to_native).to_sym
end

#to_sObject



30
31
32
# File 'lib/atom.rb', line 30

def to_s
  name.to_s
end