Class: Hotdog::Commands::Search::GlobTagNode
- Inherits:
-
GlobExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- GlobExpressionNode
- Hotdog::Commands::Search::GlobTagNode
- Defined in:
- lib/hotdog/commands/search.rb
Instance Attribute Summary
Attributes inherited from TagExpressionNode
#attribute, #identifier, #separator
Instance Method Summary collapse
- #condition(options = {}) ⇒ Object
- #condition_tables(options = {}) ⇒ Object
- #condition_values(options = {}) ⇒ Object
-
#initialize(identifier, attribute, separator = nil) ⇒ GlobTagNode
constructor
A new instance of GlobTagNode.
- #maybe_fallback(options = {}) ⇒ Object
Methods inherited from GlobExpressionNode
Methods inherited from TagExpressionNode
#==, #attribute?, #dump, #evaluate, #identifier?, #maybe_glob, #maybe_query, #maybe_query_without_condition, #optimize, #reload, #separator?, #to_glob
Methods inherited from ExpressionNode
#dump, #evaluate, #intermediates, #leafs, #optimize
Constructor Details
#initialize(identifier, attribute, separator = nil) ⇒ GlobTagNode
Returns a new instance of GlobTagNode.
1125 1126 1127 |
# File 'lib/hotdog/commands/search.rb', line 1125 def initialize(identifier, attribute, separator=nil) super(identifier, attribute, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1129 1130 1131 |
# File 'lib/hotdog/commands/search.rb', line 1129 def condition(={}) "LOWER(tags.name) GLOB LOWER(?) AND LOWER(tags.value) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1133 1134 1135 |
# File 'lib/hotdog/commands/search.rb', line 1133 def condition_tables(={}) [:tags] end |
#condition_values(options = {}) ⇒ Object
1137 1138 1139 |
# File 'lib/hotdog/commands/search.rb', line 1137 def condition_values(={}) [identifier, attribute] end |
#maybe_fallback(options = {}) ⇒ Object
1141 1142 1143 1144 1145 1146 1147 1148 |
# File 'lib/hotdog/commands/search.rb', line 1141 def maybe_fallback(={}) fallback = GlobTagNode.new(to_glob(identifier), to_glob(attribute), separator) if query = fallback.maybe_query() QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |