Sha256: 8df8f763d0f5f81d0c92dca231036c32a10a759e328daebbc7d38e84e4c30a53

Contents?: true

Size: 894 Bytes

Versions: 17

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

module Waylon
  module Conditions
    # A pre-made catch-all condition for denying access
    class Default < Condition
      # Overrides normal Condition initialization to force a specific action
      def initialize(*_args) # rubocop:disable Lint/MissingSuper
        @mechanism = nil
        @action = :unknown
        @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

17 entries across 17 versions & 1 rubygems

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