Class: Fusuma::Config::ContextMatcher
- Inherits:
-
Object
- Object
- Fusuma::Config::ContextMatcher
- Defined in:
- lib/fusuma/config/context_matcher.rb
Overview
Matches context conditions for configuration lookup. Supports AND (multiple keys) and OR (array values) conditions.
Class Method Summary collapse
-
.match?(config_context, request_context) ⇒ Boolean
Check if config context matches request context.
Class Method Details
.match?(config_context, request_context) ⇒ Boolean
Check if config context matches request context. : (Hash[untyped, untyped]?, Hash[untyped, untyped]?) -> bool
14 15 16 17 18 19 20 21 |
# File 'lib/fusuma/config/context_matcher.rb', line 14 def match?(config_context, request_context) return true if config_context.nil? || config_context.empty? return false if request_context.nil? || request_context.empty? config_context.all? do |key, expected_value| match_value?(expected_value, request_context[key]) end end |