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.
1060 1061 1062 |
# File 'lib/hotdog/commands/search.rb', line 1060 def initialize(identifier, separator=nil) super(identifier, nil, separator) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1064 1065 1066 |
# File 'lib/hotdog/commands/search.rb', line 1064 def condition(={}) "hosts.name = ? OR tags.name = ? OR tags.value = ?" end |
#condition_tables(options = {}) ⇒ Object
1068 1069 1070 |
# File 'lib/hotdog/commands/search.rb', line 1068 def condition_tables(={}) [:hosts, :tags] end |
#condition_values(options = {}) ⇒ Object
1072 1073 1074 |
# File 'lib/hotdog/commands/search.rb', line 1072 def condition_values(={}) [identifier, identifier, identifier] end |
#maybe_fallback(options = {}) ⇒ Object
1076 1077 1078 1079 1080 1081 1082 1083 |
# File 'lib/hotdog/commands/search.rb', line 1076 def maybe_fallback(={}) fallback = GlobNode.new(to_glob(identifier), separator) if query = fallback.maybe_query() QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |