Class: SpectatorSport::SearchQuery::SyntaxTree::Or

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

Overview

Branch node: either side may match.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ Or

Returns a new instance of Or.



75
76
77
78
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 75

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

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



73
74
75
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 73

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



73
74
75
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 73

def right
  @right
end

Instance Method Details

#==(other) ⇒ Object



84
85
86
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 84

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

#to_scopeObject



80
81
82
# File 'app/models/spectator_sport/search_query/syntax_tree.rb', line 80

def to_scope
  left.to_scope.or(right.to_scope)
end