Class: Qiita::Elasticsearch::Nodes::TokenNode
- Inherits:
-
Object
- Object
- Qiita::Elasticsearch::Nodes::TokenNode
- Defined in:
- lib/qiita/elasticsearch/nodes/token_node.rb
Instance Method Summary collapse
-
#initialize(token, matchable_fields: nil) ⇒ TokenNode
constructor
A new instance of TokenNode.
- #to_hash ⇒ Object
Constructor Details
#initialize(token, matchable_fields: nil) ⇒ TokenNode
Returns a new instance of TokenNode.
10 11 12 13 |
# File 'lib/qiita/elasticsearch/nodes/token_node.rb', line 10 def initialize(token, matchable_fields: nil) @matchable_fields = matchable_fields @token = token end |
Instance Method Details
#to_hash ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/qiita/elasticsearch/nodes/token_node.rb', line 15 def to_hash if @token.field_name FilterQueryNode.new(@token).to_hash else MatchQueryNode.new(@token, matchable_fields: @matchable_fields).to_hash end end |