Class: Hotdog::Expression::GlobNode
Instance Attribute Summary
#separator, #tag_name, #tag_value
Instance Method Summary
collapse
#dump
#==, #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) ⇒ GlobNode
Returns a new instance of GlobNode.
948
949
950
|
# File 'lib/hotdog/expression/semantics.rb', line 948
def initialize(tag_name, separator=nil)
super(tag_name.to_s, nil, separator)
end
|
Instance Method Details
#condition(options = {}) ⇒ Object
952
953
954
|
# File 'lib/hotdog/expression/semantics.rb', line 952
def condition(options={})
"LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?)"
end
|
#condition_tables(options = {}) ⇒ Object
956
957
958
|
# File 'lib/hotdog/expression/semantics.rb', line 956
def condition_tables(options={})
[:hosts, :tags]
end
|
#condition_values(options = {}) ⇒ Object
960
961
962
|
# File 'lib/hotdog/expression/semantics.rb', line 960
def condition_values(options={})
[tag_name, tag_name, tag_name]
end
|
#maybe_fallback(options = {}) ⇒ Object
964
965
966
967
968
969
970
971
972
|
# File 'lib/hotdog/expression/semantics.rb', line 964
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
|