Class: RBGL::GUI::Wayland::Codec

Inherits:
Object
  • Object
show all
Defined in:
lib/rbgl/gui/wayland/codec.rb

Instance Method Summary collapse

Instance Method Details

#pack_args(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rbgl/gui/wayland/codec.rb', line 7

def pack_args(args)
  result = String.new

  args.each do |arg|
    case arg
    when TypedArgument
      result << pack_typed_argument(arg)
    when Integer
      result << [arg].pack("V")
    when String
      result << pack_string(arg)
    when Float
      result << [(arg * 256).to_i].pack("V")
    end
  end

  result
end

#pad_length(length) ⇒ Object



26
27
28
# File 'lib/rbgl/gui/wayland/codec.rb', line 26

def pad_length(length)
  ((length + 3) / 4) * 4
end