Class: Yeller::Rails

Inherits:
Object
  • Object
show all
Defined in:
lib/yeller/rails.rb

Defined Under Namespace

Modules: ControllerMethods, Rails2CatchingHooks, Rails3AndFourCatchingHooks Classes: Railtie

Class Method Summary collapse

Class Method Details

.clientObject



25
26
27
# File 'lib/yeller/rails.rb', line 25

def self.client
  Yeller::Rack.client
end

.configure(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/yeller/rails.rb', line 9

def self.configure(&block)
  Yeller::Rack.configure do |config|
    if defined?(::Rails)
      config.error_handler = Yeller::LogErrorHandler.new(::Rails.logger)
      config.environment = ::Rails.env.to_s
    elsif ENV['RAILS_ENV']
      config.environment = ENV['RAILS_ENV']
    end
    block.call(config)
  end
end

.enabled?Boolean



21
22
23
# File 'lib/yeller/rails.rb', line 21

def self.enabled?
  Yeller::Rack.enabled?
end

.monkeypatch_rails3!Object



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/yeller/rails.rb', line 117

def self.monkeypatch_rails3!
  if defined?(::ActionDispatch::DebugExceptions)
    ::ActionDispatch::DebugExceptions.send(:include, Yeller::Rails::Rails3AndFourCatchingHooks)
  elsif defined?(::ActionDispatch::ShowExceptions)
    ::ActionDispatch::ShowExceptions.send(:include, Yeller::Rails::Rails3AndFourCatchingHooks)
  end

  if defined?(::ActionController)
    ::ActionController::Base.send(:include, Yeller::Rails::ControllerMethods)
  end
end