Class: Baykit::BayServer::Docker::Http::H2::H2Flags

Inherits:
Object
  • Object
show all
Defined in:
lib/baykit/bayserver/docker/http/h2/h2_flags.rb

Constant Summary collapse

FLAGS_NONE =
0x0
FLAGS_ACK =
0x1
FLAGS_END_STREAM =
0x1
FLAGS_END_HEADERS =
0x4
FLAGS_PADDED =
0x8
FLAGS_PRIORITY =
0x20

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags = FLAGS_NONE) ⇒ H2Flags

Returns a new instance of H2Flags.



16
17
18
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 16

def initialize(flags=FLAGS_NONE)
  @flags = flags
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



14
15
16
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 14

def flags
  @flags
end

Instance Method Details

#ack?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 32

def ack?()
  flag?(FLAGS_ACK)
end

#end_headers?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 48

def end_headers?
  flag?(FLAGS_END_HEADERS)
end

#end_stream?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 40

def end_stream?
  flag?(FLAGS_END_STREAM)
end

#flag?(flag) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 20

def flag?(flag)
  (flags & flag) != 0
end

#padded?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 56

def padded?
  flag?(FLAGS_PADDED)
end

#priority?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 64

def priority?
  flag?(FLAGS_PRIORITY)
end

#set_ack(val) ⇒ Object



36
37
38
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 36

def set_ack(val)
  set_flag(FLAGS_ACK, val)
end

#set_end_headers(val) ⇒ Object



52
53
54
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 52

def set_end_headers(val)
  set_flag(FLAGS_END_HEADERS, val)
end

#set_end_stream(val) ⇒ Object



44
45
46
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 44

def set_end_stream(val)
  set_flag(FLAGS_END_STREAM, val)
end

#set_flag(flag, val) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 24

def set_flag(flag, val)
  if val
    @flags |= flag
  else
    @flags &= ~flag
  end
end

#set_padded(val) ⇒ Object



60
61
62
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 60

def set_padded(val)
  set_flag(FLAGS_PADDED, val)
end

#set_priority(val) ⇒ Object



68
69
70
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 68

def set_priority(val)
  set_flag(FLAGS_PRIORITY, val)
end

#to_sObject



72
73
74
# File 'lib/baykit/bayserver/docker/http/h2/h2_flags.rb', line 72

def to_s()
  @flags.to_s()
end