Class: Kafka::Protocol::ApiVersionsResponse::ApiInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/protocol/api_versions_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, min_version:, max_version:) ⇒ ApiInfo

Returns a new instance of ApiInfo.



10
11
12
# File 'lib/kafka/protocol/api_versions_response.rb', line 10

def initialize(api_key:, min_version:, max_version:)
  @api_key, @min_version, @max_version = api_key, min_version, max_version
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'lib/kafka/protocol/api_versions_response.rb', line 8

def api_key
  @api_key
end

#max_versionObject (readonly)

Returns the value of attribute max_version.



8
9
10
# File 'lib/kafka/protocol/api_versions_response.rb', line 8

def max_version
  @max_version
end

#min_versionObject (readonly)

Returns the value of attribute min_version.



8
9
10
# File 'lib/kafka/protocol/api_versions_response.rb', line 8

def min_version
  @min_version
end

Instance Method Details

#api_nameObject



14
15
16
# File 'lib/kafka/protocol/api_versions_response.rb', line 14

def api_name
  Protocol.api_name(api_key)
end

#inspectObject



26
27
28
# File 'lib/kafka/protocol/api_versions_response.rb', line 26

def inspect
  "#<Kafka api version #{to_s}>"
end

#to_sObject



22
23
24
# File 'lib/kafka/protocol/api_versions_response.rb', line 22

def to_s
  "#{api_name}=#{min_version}..#{max_version}"
end

#version_supported?(version) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/kafka/protocol/api_versions_response.rb', line 18

def version_supported?(version)
  (min_version..max_version).include?(version)
end