Class: Hotdog::Expression::GlobTagvalueNode
- Inherits:
-
GlobExpressionNode
- Object
- ExpressionNode
- TagExpressionNode
- GlobExpressionNode
- Hotdog::Expression::GlobTagvalueNode
- Defined in:
- lib/hotdog/expression/semantics.rb
Instance Attribute Summary
Attributes inherited from TagExpressionNode
#separator, #tagname, #tagvalue
Instance Method Summary collapse
- #condition(options = {}) ⇒ Object
- #condition_tables(options = {}) ⇒ Object
- #condition_values(options = {}) ⇒ Object
-
#initialize(tagvalue, separator = nil, options = {}) ⇒ GlobTagvalueNode
constructor
A new instance of GlobTagvalueNode.
- #maybe_fallback(options = {}) ⇒ Object
Methods inherited from GlobExpressionNode
Methods inherited from TagExpressionNode
#==, #dump, #evaluate, #maybe_glob, #maybe_query, #maybe_query_without_condition, #optimize, #separator?, #tagname?, #tagvalue?, #to_glob
Methods inherited from ExpressionNode
#==, #compact, #dump, #evaluate, #optimize
Constructor Details
#initialize(tagvalue, separator = nil, options = {}) ⇒ GlobTagvalueNode
Returns a new instance of GlobTagvalueNode.
1004 1005 1006 |
# File 'lib/hotdog/expression/semantics.rb', line 1004 def initialize(tagvalue, separator=nil, ={}) super(nil, tagvalue.to_s, separator, ) end |
Instance Method Details
#condition(options = {}) ⇒ Object
1008 1009 1010 |
# File 'lib/hotdog/expression/semantics.rb', line 1008 def condition(={}) "LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?)" end |
#condition_tables(options = {}) ⇒ Object
1012 1013 1014 |
# File 'lib/hotdog/expression/semantics.rb', line 1012 def condition_tables(={}) [:hosts, :tags] end |
#condition_values(options = {}) ⇒ Object
1016 1017 1018 |
# File 'lib/hotdog/expression/semantics.rb', line 1016 def condition_values(={}) [tagvalue, tagvalue] end |
#maybe_fallback(options = {}) ⇒ Object
1020 1021 1022 1023 1024 1025 1026 1027 1028 |
# File 'lib/hotdog/expression/semantics.rb', line 1020 def maybe_fallback(={}) fallback = GlobTagvalueNode.new(to_glob(tagvalue), separator) query = fallback.maybe_query() if query QueryExpressionNode.new(query, fallback.condition_values()) else nil end end |