Class: Scim2::Filter::SimpleHandler
- Inherits:
-
Object
- Object
- Scim2::Filter::SimpleHandler
- Defined in:
- lib/scim2/filter/simple_handler.rb
Overview
Note:
This handler is intended only as a reference implementation for custom handlers and is otherwise not designed for production use.
Reference implementation of parser handler which captures parsed filters into a deeply nested Hash structure.
Instance Method Summary collapse
-
#on_attribute_filter(attribute_path, value, context:, op:, schema: nil) ⇒ Hash<Symbol, Object>
Handle basic attribute comparison filters (e.g.
preference.color eq "red"
). -
#on_logical_filter(filter1, filter2, context:, op:) ⇒ Hash<Symbol, Object>
Handle logical filters (e.g.
name.givenName sw "D" AND title co "VP"
). -
#on_nested_filter(attribute_path, filter, context:, schema: nil) ⇒ Hash<Symbol, Object>
Handle nested filters (e.g.
emails[type eq "work"]
). -
#on_not_filter(filter, context:) ⇒ Hash<Symbol, Object>
Handle NOT filters (e.g.
not (color eq "red")
).
Instance Method Details
#on_attribute_filter(attribute_path, value, context:, op:, schema: nil) ⇒ Hash<Symbol, Object>
Handle basic attribute comparison filters (e.g. preference.color eq "red"
)
85 86 87 |
# File 'lib/scim2/filter/simple_handler.rb', line 85 def on_attribute_filter(attribute_path, value, context:, op:, schema: nil) { op => { path: attribute_path, value: value, schema: schema } } end |
#on_logical_filter(filter1, filter2, context:, op:) ⇒ Hash<Symbol, Object>
Handle logical filters (e.g. name.givenName sw "D" AND title co "VP"
)
94 95 96 |
# File 'lib/scim2/filter/simple_handler.rb', line 94 def on_logical_filter(filter1, filter2, context:, op:) { op => [filter1, filter2] } end |
#on_nested_filter(attribute_path, filter, context:, schema: nil) ⇒ Hash<Symbol, Object>
Handle nested filters (e.g. emails[type eq "work"]
)
103 104 105 |
# File 'lib/scim2/filter/simple_handler.rb', line 103 def on_nested_filter(attribute_path, filter, context:, schema: nil) { path: attribute_path, nested: filter, schema: schema } end |
#on_not_filter(filter, context:) ⇒ Hash<Symbol, Object>
Handle NOT filters (e.g. not (color eq "red")
)
75 76 77 |
# File 'lib/scim2/filter/simple_handler.rb', line 75 def on_not_filter(filter, context:) { not: filter } end |