Class: Hotdog::Commands::Search::StringNode
- Inherits:
-
StringExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- StringExpressionNode
- Hotdog::Commands::Search::StringNode
- 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) ⇒ StringNode
constructor
A new instance of StringNode.
- #maybe_fallback(options = {}) ⇒ Object
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) ⇒ StringNode
Returns a new instance of StringNode.
1086 1087 1088 |
# File 'lib/hotdog/commands/search.rb', line 1086 def initialize(identifier, separator=nil) super(identifier, nil, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1090 1091 1092 |
# File 'lib/hotdog/commands/search.rb', line 1090 def condition(={}) "hosts.name = ? OR tags.name = ? OR tags.value = ?" end |
#condition_tables(options = {}) ⇒ Object
1094 1095 1096 |
# File 'lib/hotdog/commands/search.rb', line 1094 def condition_tables(={}) [:hosts, :tags] end |
#condition_values(options = {}) ⇒ Object
1098 1099 1100 |
# File 'lib/hotdog/commands/search.rb', line 1098 def condition_values(={}) [identifier, identifier, identifier] end |
#maybe_fallback(options = {}) ⇒ Object
1102 1103 1104 1105 1106 1107 1108 1109 1110 |
# File 'lib/hotdog/commands/search.rb', line 1102 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 |