Sha256: a5f5f22841898856bd3f4107a2307dbdf0ae7dbbd0d2d0f580096be0a55bc234

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 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)
        begin
          send(action)
        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

2 entries across 2 versions & 1 rubygems

Version Path
redis_monitor-0.0.4 lib/controllers/base_controller.rb
redis_monitor-0.0.3 lib/controllers/base_controller.rb