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(command_class, **opts) ⇒ Object



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

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

  command_class._sentry_class = klass if klass
end

Instance Method Details

#can?(action) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#executeObject



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

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

  return super if reason.nil?

  failure!(reason)

  self
end

#sentryObject



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

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

#why_cant(action) ⇒ Object



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

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