Class: Hotdog::Expression::StringNode
Instance Attribute Summary
#separator, #tag_name, #tag_value
Instance Method Summary
collapse
#==, #dump, #evaluate, #maybe_glob, #maybe_query, #maybe_query_without_condition, #optimize, #reload, #separator?, #tag_name?, #tag_value?, #to_glob
#dump, #evaluate, #optimize
Constructor Details
#initialize(tag_name, separator = nil) ⇒ StringNode
Returns a new instance of StringNode.
834
835
836
|
# File 'lib/hotdog/expression/semantics.rb', line 834
def initialize(tag_name, separator=nil)
super(tag_name.to_s, nil, separator)
end
|
Instance Method Details
#condition(options = {}) ⇒ Object
838
839
840
|
# File 'lib/hotdog/expression/semantics.rb', line 838
def condition(options={})
"hosts.name = ? OR tags.name = ? OR tags.value = ?"
end
|
#condition_tables(options = {}) ⇒ Object
842
843
844
|
# File 'lib/hotdog/expression/semantics.rb', line 842
def condition_tables(options={})
[:hosts, :tags]
end
|
#condition_values(options = {}) ⇒ Object
846
847
848
|
# File 'lib/hotdog/expression/semantics.rb', line 846
def condition_values(options={})
[tag_name, tag_name, tag_name]
end
|
#maybe_fallback(options = {}) ⇒ Object
850
851
852
853
854
855
856
857
858
|
# File 'lib/hotdog/expression/semantics.rb', line 850
def maybe_fallback(options={})
fallback = GlobNode.new(to_glob(tag_name), separator)
query = fallback.maybe_query(options)
if query
QueryExpressionNode.new(query, fallback.condition_values(options))
else
nil
end
end
|