Module: Dry::Logic

Includes:
Core::Constants
Included in:
Builder::Context
Defined in:
lib/dry/logic.rb,
lib/dry/logic/rule.rb,
lib/dry/logic/result.rb,
lib/dry/logic/builder.rb,
lib/dry/logic/version.rb,
lib/dry/logic/appliable.rb,
lib/dry/logic/evaluator.rb,
lib/dry/logic/operators.rb,
lib/dry/logic/predicates.rb,
lib/dry/logic/operations/or.rb,
lib/dry/logic/rule_compiler.rb,
lib/dry/logic/operations/and.rb,
lib/dry/logic/operations/key.rb,
lib/dry/logic/operations/set.rb,
lib/dry/logic/operations/xor.rb,
lib/dry/logic/rule/interface.rb,
lib/dry/logic/rule/predicate.rb,
lib/dry/logic/operations/attr.rb,
lib/dry/logic/operations/each.rb,
lib/dry/logic/operations/check.rb,
lib/dry/logic/operations/unary.rb,
lib/dry/logic/operations/binary.rb,
lib/dry/logic/operations/abstract.rb,
lib/dry/logic/operations/negation.rb,
lib/dry/logic/operations/implication.rb

Defined Under Namespace

Modules: Appliable, Builder, Operations, Operators, Predicates Classes: Evaluator, Result, Rule, RuleCompiler

Constant Summary collapse

VERSION =
"1.5.0"

Class Method Summary collapse

Class Method Details

.loaderObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dry/logic.rb', line 10

def self.loader
  @loader ||= Zeitwerk::Loader.new.tap do |loader|
    root = File.expand_path("..", __dir__)
    loader.tag = "dry-logic"
    loader.inflector = Zeitwerk::GemInflector.new("#{root}/dry-logic.rb")
    loader.push_dir(root)
    loader.ignore(
      "#{root}/dry-logic.rb",
      "#{root}/dry/logic/version.rb"
    )
  end
end

.Rule(*args, **options, &block) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/dry/logic/rule.rb', line 7

def self.Rule(*args, **options, &block)
  if args.any?
    Rule.build(*args, **options)
  elsif block
    Rule.build(block, **options)
  end
end