class Elastics::Template::Tags
Constants
- TAG_REGEXP
Public Instance Methods
partial_and_tag_names()
click to toggle source
# File lib/elastics/template/tags.rb, line 33 def partial_and_tag_names map(&:name).partition{|n| n.to_s =~ /^_/} end
stringify(structure)
click to toggle source
# File lib/elastics/template/tags.rb, line 23 def stringify(structure) structure.inspect.gsub(/(?:"#{TAG_REGEXP}"|#{TAG_REGEXP})/) do match = $& match =~ TAG_REGEXP t = Tag.new($1, $2) push t unless find{|i| i.name == t.name} (match !~ /^"/) ? "\#{vars.fetch_value(:'#{t.name}')}" : "vars.fetch_value(:'#{t.name}')" end end
variables()
click to toggle source
tag variables are the defaults defined with the tag a variable could be optional, and the default could be nil
# File lib/elastics/template/tags.rb, line 9 def variables tag_variables = Vars.new each do |t| if t.default || t.optional if t.name =~ /\./ # set default for nested var tag_variables.store_nested(t.name, t.default) else tag_variables[t.name] = t.default end end end tag_variables end