Class: Chewy::Query::Nodes::Or
- Defined in:
- lib/chewy/query/nodes/or.rb
Instance Method Summary collapse
- #__nodes__ ⇒ Object
- #__render__ ⇒ Object
-
#initialize(*nodes) ⇒ Or
constructor
A new instance of Or.
Methods inherited from Expr
Methods inherited from Base
Constructor Details
#initialize(*nodes) ⇒ Or
Returns a new instance of Or.
5 6 7 8 |
# File 'lib/chewy/query/nodes/or.rb', line 5 def initialize(*nodes) @options = nodes. @nodes = nodes.flatten.map { |node| node.is_a?(self.class) ? node.__nodes__ : node }.flatten end |
Instance Method Details
#__nodes__ ⇒ Object
10 11 12 |
# File 'lib/chewy/query/nodes/or.rb', line 10 def __nodes__ @nodes end |
#__render__ ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/chewy/query/nodes/or.rb', line 14 def __render__ nodes = @nodes.map(&:__render__) if @options.key?(:cache) {or: {filters: nodes, _cache: !!@options[:cache]}} else {or: nodes} end end |