Sha256: 704380e5facb5183f35a4cb51f945aba0f9773a8748a1692e45249bc7245b864

Contents?: true

Size: 898 Bytes

Versions: 15

Compression:

Stored size: 898 Bytes

Contents

# frozen_string_literal: true

module Waylon
  module Conditions
    # A pre-made catch-all condition for ignoring messages
    class BlackHole < Condition
      # Overrides normal Condition initialization to force a specific action
      def initialize(*_args) # rubocop:disable Lint/MissingSuper
        @mechanism = nil
        @action = :ignore
        @allowed_groups = [:everyone]
        @help = ""
      end

      # Matches any input (since the Default route, when used, should always function)
      # @return [Boolean]
      def matches?(_input)
        true
      end

      # Permits any user (since the Default route, when used, should always function)
      # @return [Boolean]
      def permits?(_user)
        true
      end

      # Just provides back all input as a single token
      # @return [Array<String>]
      def tokens(input)
        [input]
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
waylon-core-0.3.0 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.6 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.5 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.4 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.3 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.2 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.1 lib/waylon/conditions/black_hole.rb
waylon-core-0.2.0 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.9 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.8 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.6 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.5 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.4 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.3 lib/waylon/conditions/black_hole.rb
waylon-core-0.1.2 lib/waylon/conditions/black_hole.rb