File: types.rb

package info (click to toggle)
ruby-aws-eventstream 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 108 kB
  • sloc: ruby: 283; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

module Aws
  module EventStream

    # Message Header Value Types
    module Types

      def self.types
        [
          'bool_true',
          'bool_false',
          'byte',
          'short',
          'integer',
          'long',
          'bytes',
          'string',
          'timestamp',
          'uuid'
        ]
      end

      # pack/unpack pattern, byte size, type idx
      def self.pattern
        {
          'bool_true' => [true, 0, 0],
          'bool_false' => [false, 0, 1],
          'byte' => ["c", 1, 2],
          'short' => ["s>", 2, 3],
          'integer' => ["l>", 4, 4],
          'long' => ["q>", 8, 5],
          'bytes' => [nil, nil, 6],
          'string' => [nil, nil, 7],
          'timestamp' => ["q>", 8, 8],
          'uuid' => [nil, 16, 9]
        }
      end

    end
  end
end