Sha256: 6cb3083fb1c99498b13960b600220e87be75893a0145144e34505747e5b5f7e6

Contents?: true

Size: 792 Bytes

Versions: 27

Compression:

Stored size: 792 Bytes

Contents

module Foobara
  # TODO: move to foobara monorepo if this is generic...
  class CommandRegistry
    class AllowedRule
      class << self
        def allowed_rule_attributes_type
          @allowed_rule_attributes_type ||= GlobalDomain.foobara_type_from_declaration(
            symbol: :symbol,
            # TODO: add a function type and a way to union two types so that we can string or function type checking
            explanation: :duck,
            logic: :duck
          )
        end
      end

      attr_accessor :block, :explanation, :symbol

      def initialize(symbol: nil, explanation: nil, &block)
        self.symbol = symbol
        self.block = block
        self.explanation = explanation || symbol
      end

      def to_proc
        block
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.6 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.5 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.4 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.3 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.2 projects/command_connectors/src/command_registry/allowed_rule.rb
foobara-0.0.1 projects/command_connectors/src/command_registry/allowed_rule.rb