Module: Redmon::Helpers

Includes:
Redis
Defined in:
lib/redmon/helpers.rb

Constant Summary

Constants included from Redis

Redis::UNSUPPORTED

Instance Method Summary collapse

Methods included from Redis

#config, #connection_refused, #empty_result, #ns, #redis, #redis_host, #redis_url, #stats_key, #supported?, #unknown, #unquoted, #wrong_number_of_arguments_for

Instance Method Details

#absolute_url(path = '') ⇒ Object



21
22
23
# File 'lib/redmon/helpers.rb', line 21

def absolute_url(path='')
  "#{uri(nil, false)}#{path.sub(%r{^\/+}, '')}"
end

#countObject



17
18
19
# File 'lib/redmon/helpers.rb', line 17

def count
  -(params[:count] ? params[:count].to_i : 1)
end

#num_samples_to_requestObject



13
14
15
# File 'lib/redmon/helpers.rb', line 13

def num_samples_to_request
  (Redmon.config.data_lifespan * 60) / Redmon.config.poll_interval
end

#poll_intervalObject



9
10
11
# File 'lib/redmon/helpers.rb', line 9

def poll_interval
  Redmon.config.poll_interval * 1000
end

#promptObject



5
6
7
# File 'lib/redmon/helpers.rb', line 5

def prompt
  "#{redis_url.gsub('://', ' ')}>"
end