Class: Hotdog::Commands::Search::GlobNode
- Inherits:
-
GlobExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- GlobExpressionNode
- Hotdog::Commands::Search::GlobNode
- 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, separator = nil) ⇒ GlobNode
constructor
A new instance of GlobNode.
- #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, separator = nil) ⇒ GlobNode
Returns a new instance of GlobNode.
1206 1207 1208 |
# File 'lib/hotdog/commands/search.rb', line 1206 def initialize(identifier, separator=nil) super(identifier, nil, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1210 1211 1212 |
# File 'lib/hotdog/commands/search.rb', line 1210 def condition(={}) "LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1214 1215 1216 |
# File 'lib/hotdog/commands/search.rb', line 1214 def condition_tables(={}) [:hosts, :tags] end |
#condition_values(options = {}) ⇒ Object
1218 1219 1220 |
# File 'lib/hotdog/commands/search.rb', line 1218 def condition_values(={}) [identifier, identifier, identifier] end |
#maybe_fallback(options = {}) ⇒ Object
1222 1223 1224 1225 1226 1227 1228 1229 |
# File 'lib/hotdog/commands/search.rb', line 1222 def maybe_fallback(={}) fallback = GlobNode.new(to_glob(identifier), separator) if query = fallback.maybe_query() QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |