Class: Waylon::Conditions::BlackHole

Inherits:
Waylon::Condition show all
Defined in:
lib/waylon/conditions/black_hole.rb

Overview

A pre-made catch-all condition for ignoring messages

Instance Attribute Summary

Attributes inherited from Waylon::Condition

#action, #help, #mechanism

Instance Method Summary collapse

Methods inherited from Waylon::Condition

#mention_only?, #named_tokens, #properly_mentions?

Constructor Details

#initialize(*_args) ⇒ BlackHole

Overrides normal Condition initialization to force a specific action



8
9
10
11
12
13
# File 'lib/waylon/conditions/black_hole.rb', line 8

def initialize(*_args) # rubocop:disable Lint/MissingSuper
  @mechanism = nil
  @action = :ignore
  @allowed_groups = [:everyone]
  @help = ""
end

Instance Method Details

#matches?(_input) ⇒ Boolean

Matches any input (since the Default route, when used, should always function)

Returns:

  • (Boolean)


17
18
19
# File 'lib/waylon/conditions/black_hole.rb', line 17

def matches?(_input)
  true
end

#permits?(_user) ⇒ Boolean

Permits any user (since the Default route, when used, should always function)

Returns:

  • (Boolean)


23
24
25
# File 'lib/waylon/conditions/black_hole.rb', line 23

def permits?(_user)
  true
end

#tokens(input) ⇒ Array<String>

Just provides back all input as a single token

Returns:

  • (Array<String>)


29
30
31
# File 'lib/waylon/conditions/black_hole.rb', line 29

def tokens(input)
  [input]
end