Class: Hotdog::Expression::RegexpTagNode

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(tagname, tagvalue, separator = nil, options = {}) ⇒ RegexpTagNode

Returns a new instance of RegexpTagNode.



1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
# File 'lib/hotdog/expression/semantics.rb', line 1093

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

Instance Method Details

#condition(options = {}) ⇒ Object



1105
1106
1107
# File 'lib/hotdog/expression/semantics.rb', line 1105

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

#condition_tables(options = {}) ⇒ Object



1109
1110
1111
# File 'lib/hotdog/expression/semantics.rb', line 1109

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

#condition_values(options = {}) ⇒ Object



1113
1114
1115
# File 'lib/hotdog/expression/semantics.rb', line 1113

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