Class: Slim::Interpolation Private
- Defined in:
- lib/slim/interpolation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Perform interpolation of #var_name
Instance Method Summary collapse
-
#on_slim_text(string) ⇒ Array
private
Handle text expression ‘[:slim, :text, string]`.
Methods inherited from Filter
#on_slim_attrs, #on_slim_control, #on_slim_output, #on_slim_tag, #tmp_var
Instance Method Details
#on_slim_text(string) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Handle text expression ‘[:slim, :text, string]`
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/slim/interpolation.rb', line 9 def on_slim_text(string) # Interpolate variables in text (#{variable}). # Split the text into multiple dynamic and static parts. block = [:multi] until string.empty? case string when /^\\(\#\{[^\}]*\})/ # Escaped interpolation block << [:static, $1] when /^\#\{([^\}]*)\}/ # Interpolation block << [:slim, :output, true, $1, [:multi]] when /^([^\#]+|\#)/ # Static text block << [:static, $&] end string = $' end block end |