Class: Ecoportal::API::GraphQL::Input::SearchConf::HasAny
- Inherits:
-
Object
- Object
- Ecoportal::API::GraphQL::Input::SearchConf::HasAny
- Includes:
- Composable
- Defined in:
- lib/ecoportal/api/graphql/input/search_conf.rb
Overview
Filter: has_any_filter / doesnt_have_any_filter — register FIELD value membership
(Select, CrossReference, People, …). Distinct from one_of (an OR of exact_filter,
for SYSTEM keys): a register field matches via the nested membranes.
backend Pages::*::HasAnyFilter.
Instance Method Summary collapse
-
#initialize(key, values, field_key: 'selected', exclude: false) ⇒ HasAny
constructor
A new instance of HasAny.
- #substitute(subs) ⇒ Object
- #to_h ⇒ Object
Methods included from Composable
Constructor Details
#initialize(key, values, field_key: 'selected', exclude: false) ⇒ HasAny
Returns a new instance of HasAny.
159 160 161 162 163 164 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 159 def initialize(key, values, field_key: 'selected', exclude: false) @key = key.to_s @values = Array(values) @field_key = field_key @exclude = exclude end |
Instance Method Details
#substitute(subs) ⇒ Object
179 180 181 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 179 def substitute(subs) self.class.new(@key, subs.fetch(:values, @values), field_key: @field_key, exclude: @exclude) end |
#to_h ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 166 def to_h op = @exclude ? 'doesnt_have_any_filter' : 'has_any_filter' { operation: op, params: { key: @key, path: MembranePath.membrane_path_for(@key), field_key: @field_key, values: @values } } end |