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.
1237 1238 1239 |
# File 'lib/hotdog/commands/search.rb', line 1237 def initialize(identifier, separator=nil) super(identifier, nil, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1241 1242 1243 |
# File 'lib/hotdog/commands/search.rb', line 1241 def condition(={}) "LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1245 1246 1247 |
# File 'lib/hotdog/commands/search.rb', line 1245 def condition_tables(={}) [:hosts, :tags] end |
#condition_values(options = {}) ⇒ Object
1249 1250 1251 |
# File 'lib/hotdog/commands/search.rb', line 1249 def condition_values(={}) [identifier, identifier, identifier] end |
#maybe_fallback(options = {}) ⇒ Object
1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'lib/hotdog/commands/search.rb', line 1253 def maybe_fallback(={}) fallback = GlobNode.new(to_glob(identifier), separator) query = fallback.maybe_query() if query QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |