Class: ActiveWindowX::Atom

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

Overview

binding for Atom on X11

Constant Summary collapse

@@cache =
{}

Instance Attribute Summary

Attributes inherited from Xid

#display, #id

Instance Method Summary collapse

Methods inherited from Xid

#==

Constructor Details

#initialize(display, second) ⇒ Atom

Returns a new instance of Atom.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_window_x/atom.rb', line 9

def initialize display, second
  if second.kind_of? Numeric
    super
  elsif second.kind_of? String
    super
    @id = display.intern_atom second
    if @id == Xlib::None
      raise ArgumentError, 'invalid an atom name: #{second}'
    end
  else
    raise ArgumentError, 'expect Numeric or String with the second argument'
  end
end

Instance Method Details

#nameObject



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

def name
  @display.atom_name @id
end