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.
1125 1126 1127 |
# File 'lib/hotdog/commands/search.rb', line 1125 def initialize(attribute, separator=nil) super("host", attribute, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1129 1130 1131 |
# File 'lib/hotdog/commands/search.rb', line 1129 def condition(={}) "LOWER(hosts.name) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1133 1134 1135 |
# File 'lib/hotdog/commands/search.rb', line 1133 def condition_tables(={}) [:hosts] end |
#condition_values(options = {}) ⇒ Object
1137 1138 1139 |
# File 'lib/hotdog/commands/search.rb', line 1137 def condition_values(={}) [attribute] end |
#maybe_fallback(options = {}) ⇒ Object
1141 1142 1143 1144 1145 1146 1147 1148 1149 |
# File 'lib/hotdog/commands/search.rb', line 1141 def maybe_fallback(={}) fallback = GlobHostNode.new(to_glob(attribute), separator) query = fallback.maybe_query() if query QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |