class Ravanello::Analyze

Redis analyze command

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/ravanello/analyze.rb, line 11
def initialize(options)
  @options = options
end

Public Instance Methods

call() click to toggle source
# File lib/ravanello/analyze.rb, line 15
def call
  router = Yaml.new(File.read(options.fetch('rules'))).call
  cursor = Redis::Cursor.new(redis, limit: redis_fetch_limit)
  statistics = Analyzer.new(router, cursor).call
  print(statistics)
  print_samples(statistics)
end

Private Instance Methods

print(statistics) click to toggle source
print_samples(statistics) click to toggle source
redis() click to toggle source
# File lib/ravanello/analyze.rb, line 36
def redis
  @redis ||= ::Redis.new(url: ENV['REDIS'])
end
redis_fetch_limit() click to toggle source
# File lib/ravanello/analyze.rb, line 40
def redis_fetch_limit
  fetch_limit = ENV['FETCH_LIMIT']
  fetch_limit.nil? || fetch_limit == '' ? nil : fetch_limit.to_i
end