Class: Hotdog::Expression::RegexpHostNode

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) ⇒ RegexpHostNode

Returns a new instance of RegexpHostNode.



1024
1025
1026
1027
1028
1029
1030
# File 'lib/hotdog/expression/semantics.rb', line 1024

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

Instance Method Details

#condition(options = {}) ⇒ Object



1032
1033
1034
# File 'lib/hotdog/expression/semantics.rb', line 1032

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

#condition_tables(options = {}) ⇒ Object



1036
1037
1038
# File 'lib/hotdog/expression/semantics.rb', line 1036

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

#condition_values(options = {}) ⇒ Object



1040
1041
1042
# File 'lib/hotdog/expression/semantics.rb', line 1040

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