module Excom::Plugins::Sentry::ClassMethods

Attributes

_sentry_class[W]

Public Instance Methods

_sentry_class() click to toggle source
# File lib/excom/plugins/sentry.rb, line 67
def _sentry_class
  @_sentry_class ||= "#{name}Sentry"
end
inherited(service_class) click to toggle source
Calls superclass method
# File lib/excom/plugins/sentry.rb, line 43
def inherited(service_class)
  super
  service_class.sentry_class(_sentry_class)
end
sentry(delegate: [], &block) click to toggle source
# File lib/excom/plugins/sentry.rb, line 71
def sentry(delegate: [], &block)
  (plugins[:sentry].options[:delegate] ||= []).concat(delegate).uniq!

  if const_defined?(:Sentry)
    const_get(:Sentry).class_eval(&block)
  else
    @_sentry_class = @sentry_class = Class.new(Sentry, &block)
    @sentry_class.service_class = self
    const_set(:Sentry, @_sentry_class)
  end
end
sentry_class(klass = UNDEFINED) click to toggle source
# File lib/excom/plugins/sentry.rb, line 48
def sentry_class(klass = UNDEFINED)
  return self._sentry_class = klass unless klass == UNDEFINED
  return @sentry_class if defined? @sentry_class

  @sentry_class =
    if _sentry_class.is_a?(String)
      return _sentry_class.constantize if _sentry_class.respond_to?(:constantize)

      names = _sentry_class.split('::'.freeze)
      names.shift if names.first.empty?
      names.reduce(Object){ |obj, name| obj.const_get(name) }
    else
      _sentry_class
    end

  @sentry_class.service_class = self
  @sentry_class
end