Sha256: 83ee347e1a6f9ea559c4e6d7348670b5cb19d51c75d6598710daf017e58904db

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

module Rubanok
  class UnexpectedInputError < StandardError
  end

  module DSL
    module Matching : Processor
      class Rule < Rubanok::Rule
        METHOD_PREFIX: String
        @method_name: String
        @fields: Array[field]

        class Clause < Rubanok::Rule
          @fields: Array[field]

          attr_reader values: params
          attr_reader id: String
          attr_reader block: ^() -> input

          def initialize: (String id, Array[field] fields, untyped values, ?activate_on: field | Array[field], ?activate_always: bool) { () -> input } -> void
          def applicable?: (params) -> bool

          alias to_method_name id
        end

        attr_reader clauses: Array[Clause]

        def matching_clause: (hash params) -> Clause?
        def having: (*untyped values) { () -> input } -> void
        def default: () { () -> input } -> void

        private
        def build_method_name: () -> String
      end

      module ClassMethods : Module, _RulesAdding, Matching
        def match: (*field fields, ?activate_on: field | Array[field], ?activate_always: bool, ?fail_when_no_matches: bool?) { (Rule) -> void } -> void
      end

      def self.included: (singleton(Processor) base) -> void

      def default_match_handler: (Rule rule, hash params, bool? fail_when_no_matches) -> void
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubanok-0.4.0 sig/rubanok/dsl/matching.rbs