Class: Hotdog::Commands::Search::GlobHostNode
- Inherits:
-
GlobExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- GlobExpressionNode
- Hotdog::Commands::Search::GlobHostNode
- 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(attribute, separator = nil) ⇒ GlobHostNode
constructor
A new instance of GlobHostNode.
- #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(attribute, separator = nil) ⇒ GlobHostNode
Returns a new instance of GlobHostNode.
1098 1099 1100 |
# File 'lib/hotdog/commands/search.rb', line 1098 def initialize(attribute, separator=nil) super("host", attribute, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1102 1103 1104 |
# File 'lib/hotdog/commands/search.rb', line 1102 def condition(={}) "LOWER(hosts.name) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1106 1107 1108 |
# File 'lib/hotdog/commands/search.rb', line 1106 def condition_tables(={}) [:hosts] end |
#condition_values(options = {}) ⇒ Object
1110 1111 1112 |
# File 'lib/hotdog/commands/search.rb', line 1110 def condition_values(={}) [attribute] end |
#maybe_fallback(options = {}) ⇒ Object
1114 1115 1116 1117 1118 1119 1120 1121 |
# File 'lib/hotdog/commands/search.rb', line 1114 def maybe_fallback(={}) fallback = GlobHostNode.new(to_glob(attribute), separator) if query = fallback.maybe_query() QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |