Class: Ecoportal::API::GraphQL::Input::SearchConf::Exact

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/ecoportal/api/graphql/input/search_conf.rb

Overview


Filter: exact_filter

Constant Summary collapse

OPERATION =
'exact_filter'.freeze

Instance Method Summary collapse

Methods included from Composable

#&, #|

Constructor Details

#initialize(key, value) ⇒ Exact

Returns a new instance of Exact.



78
79
80
81
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 78

def initialize(key, value)
  @key   = key.to_s
  @value = value
end

Instance Method Details

#substitute(subs) ⇒ Object



87
88
89
90
91
92
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 87

def substitute(subs)
  key_sym = @key.to_sym
  return self unless subs.key?(key_sym)

  self.class.new(@key, subs[key_sym])
end

#to_hObject



83
84
85
# File 'lib/ecoportal/api/graphql/input/search_conf.rb', line 83

def to_h
  { operation: OPERATION, params: { key: @key, value: @value } }
end