Class: Hotdog::Commands::Search::TagGlobExpressionNode
- Inherits:
-
TagExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- Hotdog::Commands::Search::TagGlobExpressionNode
- Defined in:
- lib/hotdog/commands/search.rb
Instance Attribute Summary
Attributes inherited from TagExpressionNode
Instance Method Summary collapse
Methods inherited from TagExpressionNode
Constructor Details
This class inherits a constructor from Hotdog::Commands::Search::TagExpressionNode
Instance Method Details
#evaluate(environment) ⇒ Object
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/hotdog/commands/search.rb', line 232 def evaluate(environment) if attribute? environment.execute(" SELECT DISTINCT hosts_tags.host_id FROM hosts_tags\n INNER JOIN tags ON hosts_tags.tag_id = tags.id\n WHERE LOWER(tags.name) GLOB LOWER(?) AND LOWER(tags.value) GLOB LOWER(?);\n EOS\n else\n environment.execute(<<-EOS, identifier, identifier, identifier).map { |row| row.first }\n SELECT DISTINCT hosts_tags.host_id FROM hosts_tags\n INNER JOIN hosts ON hosts_tags.host_id = hosts.id\n INNER JOIN tags ON hosts_tags.tag_id = tags.id\n WHERE LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?);\n\n EOS\n end\nend\n", identifier, attribute).map { |row| row.first } |