Class: Hotdog::Expression::RegexpTagNode

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_name, tag_value, separator = nil) ⇒ RegexpTagNode

Returns a new instance of RegexpTagNode.



1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/hotdog/expression/semantics.rb', line 1046

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

Instance Method Details

#condition(options = {}) ⇒ Object



1058
1059
1060
# File 'lib/hotdog/expression/semantics.rb', line 1058

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

#condition_tables(options = {}) ⇒ Object



1062
1063
1064
# File 'lib/hotdog/expression/semantics.rb', line 1062

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

#condition_values(options = {}) ⇒ Object



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

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