YuiRestClient::Filter - manage filter for YuiRestClient
Copyright 2021 SUSE LLC
SPDX-License-Identifier: FSFAP
QE Yam <qe-yam at suse de>
$filter = YuiRestClient::Filter->new($filter);
return $self->{widget_controller}->find($self->{filter}->get_filter());
return $self->{filter}->is_resolved();
Every YUI object that is created in the YuiRestClient is identified with a 'filter' that identifies the object. This class provides methods to work with those filters.
Class attributes:
Object methods:
new($args) - create a filter object.
The argument $args is a hash that can contain several key/value pairs to identify an UI object. Key values match the keys in the JSON representation of the UI widgets and values can be either simple strings or regular expressions ( qr/.../).
get_filter() - returns the filter hash used to create the filter object
Note that when a regex was used on creation then this is removed from the filter hash after initialization of the object. You need to call method resolve() to insert a filter with the found match for the regex before calling get_filter() then.
is_resolved() - returns status of regex matching
The method returns the value of the {resolved} attribute. This value will be altered by the resolve() method.
resolve($json) - resolve a regex
This method tries to match the regular expression that was used during object creation. If exactly one match was found the {filter} attribute gets a new key/value pair that holds the key and the true matching value for the regular expression. If the regex is resolved, then the attribute {resolve} is set to 1 (true).