Class: Gizzard::ForwardingsCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gizzard/commands.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #buffer, #command_options, #global_options, #job_injector, #manager

Instance Method Summary collapse

Methods inherited from Command

classify, #confirm!, #get_base_name, #help!, #initialize, make_job_injector, make_manager, #output, #require_tables, #require_template_options, run

Constructor Details

This class inherits a constructor from Gizzard::Command

Instance Method Details

#runObject



181
182
183
184
185
186
187
188
189
# File 'lib/gizzard/commands.rb', line 181

def run
  manager.get_forwardings.sort_by do |f|
    [ ((f.table_id.abs << 1) + (f.table_id < 0 ? 1 : 0)), f.base_id ]
  end.reject do |forwarding|
    @command_options.table_ids && !@command_options.table_ids.include?(forwarding.table_id)
  end.each do |forwarding|
    output [ forwarding.table_id, @command_options.hex ? ("%016x" % forwarding.base_id) : forwarding.base_id, forwarding.shard_id.to_unix ].join("\t")
  end
end