Skip to content

Commit e05be72

Browse files
authored
Introduce idiomatic setters
1 parent c2a8809 commit e05be72

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/meilisearch/index.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def settings
140140
def update_settings(settings)
141141
http_post "/indexes/#{@uid}/settings", settings
142142
end
143+
alias settings= update_settings
143144

144145
def reset_settings
145146
http_delete "/indexes/#{@uid}/settings"
@@ -155,6 +156,7 @@ def ranking_rules
155156
def update_ranking_rules(ranking_rules)
156157
http_post "/indexes/#{@uid}/settings/ranking-rules", ranking_rules
157158
end
159+
alias ranking_rules= update_ranking_rules
158160

159161
def reset_ranking_rules
160162
http_delete "/indexes/#{@uid}/settings/ranking-rules"
@@ -170,6 +172,7 @@ def synonyms
170172
def update_synonyms(synonyms)
171173
http_post "/indexes/#{@uid}/settings/synonyms", synonyms
172174
end
175+
alias synonyms= update_synonyms
173176

174177
def reset_synonyms
175178
http_delete "/indexes/#{@uid}/settings/synonyms"
@@ -186,6 +189,7 @@ def update_stop_words(stop_words)
186189
body = stop_words.is_a?(Array) ? stop_words : [stop_words]
187190
http_post "/indexes/#{@uid}/settings/stop-words", body
188191
end
192+
alias stop_words= update_stop_words
189193

190194
def reset_stop_words
191195
http_delete "/indexes/#{@uid}/settings/stop-words"
@@ -201,6 +205,7 @@ def distinct_attribute
201205
def update_distinct_attribute(distinct_attribute)
202206
http_post "/indexes/#{@uid}/settings/distinct-attribute", distinct_attribute
203207
end
208+
alias distinct_attribute= update_distinct_attribute
204209

205210
def reset_distinct_attribute
206211
http_delete "/indexes/#{@uid}/settings/distinct-attribute"
@@ -216,6 +221,7 @@ def searchable_attributes
216221
def update_searchable_attributes(searchable_attributes)
217222
http_post "/indexes/#{@uid}/settings/searchable-attributes", searchable_attributes
218223
end
224+
alias searchable_attributes= update_searchable_attributes
219225

220226
def reset_searchable_attributes
221227
http_delete "/indexes/#{@uid}/settings/searchable-attributes"
@@ -231,6 +237,7 @@ def displayed_attributes
231237
def update_displayed_attributes(displayed_attributes)
232238
http_post "/indexes/#{@uid}/settings/displayed-attributes", displayed_attributes
233239
end
240+
alias displayed_attributes= update_displayed_attributes
234241

235242
def reset_displayed_attributes
236243
http_delete "/indexes/#{@uid}/settings/displayed-attributes"
@@ -246,6 +253,7 @@ def attributes_for_faceting
246253
def update_attributes_for_faceting(attributes_for_faceting)
247254
http_post "/indexes/#{@uid}/settings/attributes-for-faceting", attributes_for_faceting
248255
end
256+
alias attributes_for_faceting= update_attributes_for_faceting
249257

250258
def reset_attributes_for_faceting
251259
http_delete "/indexes/#{@uid}/settings/attributes-for-faceting"

0 commit comments

Comments
 (0)