Class: RR::Integrations::Decorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/rr/integrations/decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ Decorator

Returns a new instance of Decorator.



6
7
8
9
# File 'lib/rr/integrations/decorator.rb', line 6

def initialize(adapter)
  super(adapter)
  @loaded = false
end

Instance Method Details

#applies?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/rr/integrations/decorator.rb', line 15

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

#loadObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rr/integrations/decorator.rb', line 24

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

#loaded?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/rr/integrations/decorator.rb', line 38

def loaded?
  @loaded
end

#nameObject



11
12
13
# File 'lib/rr/integrations/decorator.rb', line 11

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