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
797
798
799
|
# File 'lib/hotdog/expression/semantics.rb', line 797
def initialize(tag_name, separator=nil)
super(tag_name.to_s, nil, separator)
end
|
Instance Method Details
#condition(options = {}) ⇒ Object
801
802
803
|
# File 'lib/hotdog/expression/semantics.rb', line 801
def condition(options={})
"hosts.name = ? OR tags.name = ? OR tags.value = ?"
end
|
#condition_tables(options = {}) ⇒ Object
805
806
807
|
# File 'lib/hotdog/expression/semantics.rb', line 805
def condition_tables(options={})
[:hosts, :tags]
end
|
#condition_values(options = {}) ⇒ Object
809
810
811
|
# File 'lib/hotdog/expression/semantics.rb', line 809
def condition_values(options={})
[tag_name, tag_name, tag_name]
end
|
#maybe_fallback(options = {}) ⇒ Object
813
814
815
816
817
818
819
820
821
|
# File 'lib/hotdog/expression/semantics.rb', line 813
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
|