Class: Thebes::Query

Inherits:
Riddle::Client
  • Object
show all
Defined in:
lib/thebes/query.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Query

Returns a new instance of Query.



10
11
12
13
14
15
16
# File 'lib/thebes/query.rb', line 10

def initialize *args
  if !args.empty? || self.class.servers.empty?
    super *args
  else
    super *self.class.servers[rand(self.class.servers.size)]
  end
end

Class Method Details

.run(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/thebes/query.rb', line 20

def run &block
  client = new # would take server and port
  before_query.call(client) if before_query
  block.call client
  before_running.call(client) if before_running
  client.run
end