Module: Excom::Plugins::Sentry

Defined in:
lib/excom/plugins/sentry.rb,
lib/excom/plugins/sentry/sentinel.rb

Defined Under Namespace

Modules: ClassMethods Classes: Sentinel

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.used(service_class, **opts) ⇒ Object



7
8
9
10
11
12
# File 'lib/excom/plugins/sentry.rb', line 7

def self.used(service_class, **opts)
  klass = opts[:class]

  service_class.use(:status) unless service_class.using?(:status)
  service_class._sentry_class = klass if klass
end

Instance Method Details

#can?(action) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/excom/plugins/sentry.rb', line 24

def can?(action)
  why_cant?(action).nil?
end

#executeObject



14
15
16
17
18
19
20
21
22
# File 'lib/excom/plugins/sentry.rb', line 14

def execute(*)
  reason = why_cant?(:execute)

  return super if reason.nil?

  failure!(reason)

  self
end

#sentryObject



32
33
34
# File 'lib/excom/plugins/sentry.rb', line 32

def sentry
  @sentry ||= self.class.sentry_class.new(self)
end

#sentry_hashObject



36
37
38
# File 'lib/excom/plugins/sentry.rb', line 36

def sentry_hash
  sentry.to_hash
end

#why_cant?(action) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/excom/plugins/sentry.rb', line 28

def why_cant?(action)
  sentry.denial_reason(action)
end