Class: Kafkat::Command::Base

Inherits:
Object
  • Object
show all
Includes:
Kafkat::CommandIO, Formatting, Logging
Defined in:
lib/kafkat/command.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#print_err

Methods included from Kafkat::CommandIO

#prompt_and_execute_assignments

Methods included from Formatting

#justify, #print_assignment, #print_assignment_header, #print_broker, #print_broker_header, #print_partition, #print_partition_header, #print_topic, #print_topic_header, #print_topic_name

Constructor Details

#initialize(config) ⇒ Base

Returns a new instance of Base.



39
40
41
# File 'lib/kafkat/command.rb', line 39

def initialize(config)
  @config = config
end

Class Attribute Details

.command_nameObject (readonly)

Returns the value of attribute command_name.



23
24
25
# File 'lib/kafkat/command.rb', line 23

def command_name
  @command_name
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/kafkat/command.rb', line 20

def config
  @config
end

Class Method Details

.register_as(name) ⇒ Object



26
27
28
29
# File 'lib/kafkat/command.rb', line 26

def self.register_as(name)
  @command_name = name
  Command.all[name] = self
end

.usage(format, description) ⇒ Object



35
36
37
# File 'lib/kafkat/command.rb', line 35

def self.usage(format, description)
  usages << [format, description]
end

.usagesObject



31
32
33
# File 'lib/kafkat/command.rb', line 31

def self.usages
  @usages ||= []
end

Instance Method Details

#adminObject



47
48
49
50
51
# File 'lib/kafkat/command.rb', line 47

def admin
  @admin ||= begin
    Interface::Admin.new(config)
  end
end

#kafka_logsObject



59
60
61
62
63
# File 'lib/kafkat/command.rb', line 59

def kafka_logs
  @kafka_logs ||= begin
    Interface::KafkaLogs.new(config)
  end
end

#runObject

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/kafkat/command.rb', line 43

def run
  raise NotImplementedError
end

#zookeeperObject



53
54
55
56
57
# File 'lib/kafkat/command.rb', line 53

def zookeeper
  @zookeeper ||= begin
    Interface::Zookeeper.new(config)
  end
end