Class: Redis::Commands::Search::TagEqualityPredicate

Inherits:
Predicate
  • Object
show all
Defined in:
lib/redis/commands/modules/search/query.rb

Overview

A tag-equality predicate rendering (@field:{value}).

Constant Summary

Constants inherited from Predicate

Predicate::TAG_ESCAPE_PATTERN, Predicate::TAG_SPECIAL_CHARACTERS, Predicate::TEXT_ESCAPE_PATTERN, Predicate::TEXT_SPECIAL_CHARACTERS

Instance Attribute Summary

Attributes inherited from Predicate

#field

Instance Method Summary collapse

Constructor Details

#initialize(field, value) ⇒ TagEqualityPredicate

Returns a new instance of TagEqualityPredicate.

Parameters:

  • field (String) —

    the tag field name

  • value (String) —

    the tag value to match



657
658
659
660
# File 'lib/redis/commands/modules/search/query.rb', line 657

def initialize(field, value)
  super(field)
  @value = value
end

Instance Method Details

#to_s ⇒ String

Returns the query-string fragment, e.g. (@color:{red}).

Returns:

  • (String) —

    the query-string fragment, e.g. (@color:{red})



663
664
665
# File 'lib/redis/commands/modules/search/query.rb', line 663

def to_s
  "(@#{@field}:{#{escape_tag(@value)}})"
end