Class: Hotdog::Expression::RegexpTagvalueNode

Inherits:
RegexpExpressionNode show all
Defined in:
lib/hotdog/expression/semantics.rb

Instance Attribute Summary

Attributes inherited from TagExpressionNode

#separator, #tagname, #tagvalue

Instance Method Summary collapse

Methods inherited from RegexpExpressionNode

#dump

Methods inherited from TagExpressionNode

#==, #dump, #evaluate, #maybe_fallback, #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 = {}) ⇒ RegexpTagvalueNode

Returns a new instance of RegexpTagvalueNode.



1141
1142
1143
1144
1145
1146
1147
# File 'lib/hotdog/expression/semantics.rb', line 1141

def initialize(tagvalue, separator=nil, options={})
  case tagvalue
  when /\A\/(.*)\/\z/
    tagvalue = $1
  end
  super(nil, tagvalue.to_s, separator, options)
end

Instance Method Details

#condition(options = {}) ⇒ Object



1149
1150
1151
# File 'lib/hotdog/expression/semantics.rb', line 1149

def condition(options={})
  "hosts.name REGEXP ? OR tags.value REGEXP ?"
end

#condition_tables(options = {}) ⇒ Object



1153
1154
1155
# File 'lib/hotdog/expression/semantics.rb', line 1153

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

#condition_values(options = {}) ⇒ Object



1157
1158
1159
# File 'lib/hotdog/expression/semantics.rb', line 1157

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