Sha256: dd0ea66981e45b050cac7b5430f672f0b339754f90222c1a092edba34ef4b5b2

Contents?: true

Size: 946 Bytes

Versions: 78

Compression:

Stored size: 946 Bytes

Contents

#--
# Copyright (c) 2008 Jeremy Hinegardner
# All rights reserved.  See LICENSE and/or COPYING for details.
#++

module Amalgalite
  #
  # A TraceTap receives tracing information from SQLite3. It receives the SQL
  # statement being executed as a +msg+ just before the statement first begins
  # executing.
  #
  # A TraceTap is a wrapper around another object and a method.  The Tap object
  # will receive the call to +trace+ and redirect that call to another object
  # and method.
  #
  class TraceTap

    attr_reader :delegate_obj
    attr_reader :delegate_method

    def initialize( wrapped_obj, send_to = 'trace' )
      unless wrapped_obj.respond_to?( send_to ) 
        raise Amalgalite::Error, "#{wrapped_obj.class.name} does not respond to #{send_to.to_s} "
      end

      @delegate_obj = wrapped_obj
      @delegate_method = send_to
    end

    def trace( msg )
      delegate_obj.send( delegate_method, msg )
    end
  end
end

Version data entries

78 entries across 78 versions & 2 rubygems

Version Path
amalgalite-1.6.3-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.3-x64-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.3 lib/amalgalite/trace_tap.rb
amalgalite-1.6.1-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.1-x64-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.1 lib/amalgalite/trace_tap.rb
amalgalite-1.6.0-x64-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.0-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.6.0 lib/amalgalite/trace_tap.rb
amalgalite-1.5.0-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.5.0 lib/amalgalite/trace_tap.rb
amalgalite-1.4.1-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.4.1 lib/amalgalite/trace_tap.rb
amalgalite-1.4.0-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.4.0 lib/amalgalite/trace_tap.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/trace_tap.rb
amalgalite-1.3.0-x86-mswin32 lib/amalgalite/trace_tap.rb
amalgalite-1.3.0 lib/amalgalite/trace_tap.rb
amalgalite-1.1.2-x86-mingw32 lib/amalgalite/trace_tap.rb
amalgalite-1.1.2-x86-mswin32 lib/amalgalite/trace_tap.rb