Class: Qiita::Elasticsearch::Nodes::QueryNode
- Inherits:
-
Object
- Object
- Qiita::Elasticsearch::Nodes::QueryNode
- Defined in:
- lib/qiita/elasticsearch/nodes/query_node.rb
Instance Method Summary collapse
-
#initialize(tokens) ⇒ QueryNode
constructor
A new instance of QueryNode.
- #to_hash ⇒ Object
Constructor Details
#initialize(tokens) ⇒ QueryNode
Returns a new instance of QueryNode.
9 10 11 |
# File 'lib/qiita/elasticsearch/nodes/query_node.rb', line 9 def initialize(tokens) @tokens = tokens end |
Instance Method Details
#to_hash ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/qiita/elasticsearch/nodes/query_node.rb', line 13 def to_hash case @tokens.length when 0 {} when 1 MatchNode.new(@tokens.first).to_hash else MultiMustNode.new(@tokens).to_hash end end |