Class: X11::Form::Form
- Inherits:
-
Object
- Object
- X11::Form::Form
- Defined in:
- lib/X11/form.rb
Overview
A form object is an X11 packet definition. We use forms to encode and decode X11 packets as we send and receive them over a socket.
We can create a packet definition as follows:
class Point < BaseForm
field :x, Int8
field :y, Int8
end
p = Point.new(10,20)
p.x => 10
p.y => 20
p.to_packet => "\n\x14"
You can also read from a socket:
Point.from_packet(socket) => #<Point @x=10 @y=20>
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.fields ⇒ Object
28 29 30 |
# File 'lib/X11/form.rb', line 28 def self.fields [] end |
.structs ⇒ Object
24 25 26 |
# File 'lib/X11/form.rb', line 24 def self.structs [] end |