Sha256: bb853d0a209d6ac17f020be7206989829a9e0fe9a56aa8e21e1ff18b5a170fa5

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'modules/backend'
require 'errors/errors'

module RedisMonitor
  module Controllers
    class BaseController
      attr_accessor :context, :params

      include RedisMonitor::Helpers::BaseHelper
      include RedisMonitor::Helpers::LayoutsHelper

      def initialize(opts = {})
        @context = opts.delete(:context)
        @params = opts
      end

      def execute(action, params = {})
        begin
          send(action, params)
        rescue RedisMonitor::Errors::RedisNotAvailable
          redis_not_available
        end
      end

      def redis_not_available
        haml 'errors/redis_not_available'.to_sym, layout: main_layout,
                     locals: {host: Backend.host, port: Backend.port}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_monitor-0.0.5 lib/controllers/base_controller.rb