class Object
Public Instance Methods
base_path()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 3 def base_path return unless ENV['RAILS_ENV'] '/stackeye' end
metric_icon_decorator(metric)
click to toggle source
# File lib/stackeye/helpers/base.rb, line 9 def metric_icon_decorator(metric) case metric when 'server' then 'server' else 'database' end end
metric_name_decorator(metric)
click to toggle source
# File lib/stackeye/helpers/base.rb, line 16 def metric_name_decorator(metric) case metric when 'mysql' then 'MySQL' else titleize(metric) end end
modulize(str)
click to toggle source
# File lib/stackeye/helpers/base.rb, line 23 def modulize(str) str.tr('_-', ' ').split(' ').map(&:capitalize).join('') end
page?(path)
click to toggle source
# File lib/stackeye/helpers/base.rb, line 27 def page?(path) request.path == "#{base_path}#{path}" end
refreshing?()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 31 def refreshing? cookies[:refresh] == '1' end
titleize(str)
click to toggle source
# File lib/stackeye/helpers/base.rb, line 35 def titleize(str) str.tr('_', ' ').capitalize end
verified_distro?()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 39 def verified_distro? Stackeye::Tools::Os.linux? end
verified_distro_and_os?()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 48 def verified_distro_and_os? verified_distro? && verified_os? end
verified_os?()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 43 def verified_os? cmd = 'lsb_release -ds' Stackeye::Tools::Cli.execute(cmd).strip.include?('Ubuntu') end
verify_distro_and_os!()
click to toggle source
# File lib/stackeye/helpers/base.rb, line 52 def verify_distro_and_os! return if verified_distro_and_os? redirect("#{base_path}/unsupported") end