Class: Arbi::Cli::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/arbi/cli/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/arbi/cli/client.rb', line 30

def initialize
  @address  = Arbi::Config[:client][:address]
  @port     = Arbi::Config[:client][:port]
  @commands = Arbi::Config[:client][:default_cmd]

  self.parse_args

  @client = Arbi::Client.new(@address, @port)

  @commands.each {|command|
    puts("#{command.upcase}:\n" + @client.get(command).format + "\n\n") if command !~ /^(quit|exit)$/i
  }
rescue Errno::ECONNREFUSED
  puts "You have to start arbid daemon first, or specify a correct port."
  exit 1
end