Sha256: e696d68d54e65239206b45552c313b1afa0395eed2cfb8b7cc6bceaf4aea4368

Contents?: true

Size: 1.98 KB

Versions: 7

Compression:

Stored size: 1.98 KB

Contents

# MOle configuration can be either loaded as a single file or as a directory containing
# several MOle configuration for large applications. Idea contributed by Ian Schreuder !!

# The MOle configuration file tells the MOle which actions in your application you want
# to monitor. You can do whatever you want in the interceptors. The MOle comes bundled
# with a utility 'Mole::Moler' that allows you to log the interaction using either a 
# log file, the console or the database. You can scrape your logs for Mole information, but
# we've found that logging to the db is a good approach if you need to generate reports
# based on this information.
# require 'application'

# Watch my_action calls on the Moled Controller
MoledController.mole_after( :feature => :my_action ) do |context, feature, ret, block, *args|
  ::Mole::Moler.mole_it( 
    context               , 
    feature               ,
    context.session[:user],
    :state => context.instance_variable_get( "@state" ),
    :args  => context.params[:id] )
end

# Use the Mole provided convenience util to pick up all rails actions on the MoledController Class 
def all_actions() Mole::Utils::Frameworks.rails_actions( MoledController ) end

# Watch action performance on the MoledController
MoledController.mole_perf( :features => all_actions ) do |context, feature, elapsed_time, ret_val, block, *args|
  ::Mole::Moler.perf_it( 
    context                            , 
    context.session[:user]             ,
    :controller   => context.class.name,
    :feature      => feature           ,
    :args         => args              ,
    :elapsed_time => "%3.3f" % elapsed_time )
end

# Watch for exceptions raise in the MoledController
MoledController.mole_unchecked( :features => all_actions ) do |context, feature, boom, ret_val, block, *args|
  ::Mole::Moler.check_it( 
    context                          , 
    context.session[:user]           ,
    :controller => context.class.name,
    :feature    => feature           ,
    :boom       => boom )
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
derailed-mole-1.0.10 samples/railsapp/config/moles/mole_config.rb
mole-1.0.11 samples/railsapp/config/moles/mole_config.rb
mole-1.0.12 samples/railsapp/config/moles/mole_config.rb
mole-1.0.6 samples/railsapp/config/moles/mole_config.rb
mole-1.0.8 samples/railsapp/config/moles/mole_config.rb
mole-1.0.9 samples/railsapp/config/moles/mole_config.rb
mole-1.0.7 samples/railsapp/config/moles/mole_config.rb