Module: ActiveWebhook::Models::TopicAdditions

Extended by:
ActiveSupport::Concern
Included in:
Topic
Defined in:
lib/active_webhook/models/topic_additions.rb

Instance Method Summary collapse

Instance Method Details

#disable(reason = nil) ⇒ Object



27
28
29
30
# File 'lib/active_webhook/models/topic_additions.rb', line 27

def disable(reason = nil)
  self.disabled_at = Time.current
  self.disabled_reason = reason
end

#disable!(reason = nil) ⇒ Object



32
33
34
35
# File 'lib/active_webhook/models/topic_additions.rb', line 32

def disable!(reason = nil)
  disable reason
  save!
end

#disabled?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/active_webhook/models/topic_additions.rb', line 47

def disabled?
  !enabled?
end

#enableObject



37
38
39
40
# File 'lib/active_webhook/models/topic_additions.rb', line 37

def enable
  self.disabled_at = nil
  self.disabled_reason = nil
end

#enable!Object



42
43
44
45
# File 'lib/active_webhook/models/topic_additions.rb', line 42

def enable!
  enable
  save!
end

#enabled?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/active_webhook/models/topic_additions.rb', line 51

def enabled?
  disabled_at.nil?
end