Class: Hotdog::Commands::Search::StringTagNode

Inherits:
StringExpressionNode show all
Defined in:
lib/hotdog/commands/search.rb

Instance Attribute Summary

Attributes inherited from TagExpressionNode

#attribute, #identifier, #separator

Instance Method Summary collapse

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, attribute, separator = nil) ⇒ StringTagNode



1002
1003
1004
# File 'lib/hotdog/commands/search.rb', line 1002

def initialize(identifier, attribute, separator=nil)
  super(identifier, attribute, separator)
end

Instance Method Details

#condition(options = {}) ⇒ Object



1006
1007
1008
# File 'lib/hotdog/commands/search.rb', line 1006

def condition(options={})
  "tags.name = ? AND tags.value = ?"
end

#condition_tables(options = {}) ⇒ Object



1010
1011
1012
# File 'lib/hotdog/commands/search.rb', line 1010

def condition_tables(options={})
  [:tags]
end

#condition_values(options = {}) ⇒ Object



1014
1015
1016
# File 'lib/hotdog/commands/search.rb', line 1014

def condition_values(options={})
  [identifier, attribute]
end

#maybe_fallback(options = {}) ⇒ Object



1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/hotdog/commands/search.rb', line 1018

def maybe_fallback(options={})
  fallback = GlobTagNode.new(to_glob(identifier), to_glob(attribute), separator)
  query = fallback.maybe_query(options)
  if query
    QueryExpressionNode.new(query, fallback.condition_values(options))
  else
    nil
  end
end