Class: Kafkat::Command::Base

Inherits:
Object
  • Object
show all
Includes:
Kafkat::CommandIO, Formatting
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 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

Constructor Details

#initialize(config) ⇒ Base

Returns a new instance of Base.



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

def initialize(config)
  @config = config
end

Class Attribute Details

.command_nameObject (readonly)

Returns the value of attribute command_name.



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

def command_name
  @command_name
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

Class Method Details

.register_as(name) ⇒ Object



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

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

.usage(format, description) ⇒ Object



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

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

.usagesObject



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

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

Instance Method Details

#adminObject



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

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

#kafka_logsObject



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

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

#runObject

Raises:

  • (NotImplementedError)


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

def run
  raise NotImplementedError
end

#zookeeperObject



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

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