Sha256: 16478292eee28bb7c4fb9efbb516a58aacd8c9e380cfc2b55813f972eac5eac7

Contents?: true

Size: 912 Bytes

Versions: 16

Compression:

Stored size: 912 Bytes

Contents

require 'delegate'

module RR
  module Integrations
    class Decorator < SimpleDelegator
      def initialize(adapter)
        super(adapter)
        @loaded = false
      end

      def name
        __getobj__.class.to_s.split('::').last.to_sym
      end

      def applies?
        __getobj__.applies?
      rescue => e
        if RR.debug?
          puts "#{__getobj__.class}#applies? failed: #{e.class} (#{e.message})"
          puts e.backtrace.map {|x| "  " + x }.join("\n")
        end
      end

      def load
        return if @loaded
        hook
        if RR.debug?
          puts "Loaded adapter: #{name}"
        end
        @loaded = true
      rescue => e
        if RR.debug?
          puts "Couldn't load adapter #{name}: #{e.class} (#{e.message})"
          puts e.backtrace.map {|x| "  " + x }.join("\n")
        end
      end

      def loaded?
        @loaded
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rr-3.1.1 lib/rr/integrations/decorator.rb
rr-3.1.0 lib/rr/integrations/decorator.rb
rr-3.0.9 lib/rr/integrations/decorator.rb
rr-3.0.8 lib/rr/integrations/decorator.rb
rr-3.0.7 lib/rr/integrations/decorator.rb
rr-3.0.6 lib/rr/integrations/decorator.rb
rr-3.0.5 lib/rr/integrations/decorator.rb
rr-3.0.4 lib/rr/integrations/decorator.rb
rr-3.0.3 lib/rr/integrations/decorator.rb
rr-3.0.2 lib/rr/integrations/decorator.rb
rr-3.0.1 lib/rr/integrations/decorator.rb
rr-3.0.0 lib/rr/integrations/decorator.rb
rr-1.2.1 lib/rr/integrations/decorator.rb
rr-1.2.0 lib/rr/integrations/decorator.rb
rr-1.1.2 lib/rr/integrations/decorator.rb
rr-1.1.2.rc1 lib/rr/integrations/decorator.rb