Class: SpectatorSport::SearchQuery::SyntaxTree::And

Inherits:
Object
  • Object
show all
Defined in:
app/models/spectator_sport/search_query/syntax_tree.rb

Overview

Branch node: both sides must match (possibly different labels on the same recording).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ And

Returns a new instance of And.



57
58
59
60
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 57

def initialize(left, right)
  @left = left
  @right = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



55
56
57
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 55

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



55
56
57
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 55

def right
  @right
end

Instance Method Details

#==(other) ⇒ Object



66
67
68
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 66

def ==(other)
  other.is_a?(self.class) && other.left == left && other.right == right
end

#to_scopeObject



62
63
64
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 62

def to_scope
  left.to_scope.where(id: right.to_scope.select(:id))
end