Class: Hotdog::Expression::RegexpTagValueNode

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

Instance Attribute Summary

Attributes inherited from TagExpressionNode

#separator, #tag_name, #tag_value

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, #reload, #separator?, #tag_name?, #tag_value?, #to_glob

Methods inherited from ExpressionNode

#dump, #evaluate, #optimize

Constructor Details

#initialize(tag_value, separator = nil) ⇒ RegexpTagValueNode

Returns a new instance of RegexpTagValueNode.



1057
1058
1059
1060
1061
1062
1063
# File 'lib/hotdog/expression/semantics.rb', line 1057

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

Instance Method Details

#condition(options = {}) ⇒ Object



1065
1066
1067
# File 'lib/hotdog/expression/semantics.rb', line 1065

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

#condition_tables(options = {}) ⇒ Object



1069
1070
1071
# File 'lib/hotdog/expression/semantics.rb', line 1069

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

#condition_values(options = {}) ⇒ Object



1073
1074
1075
# File 'lib/hotdog/expression/semantics.rb', line 1073

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