Class: Slim::DoInserter Private
- Defined in:
- lib/slim/do_inserter.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.
In Slim you don't need the do keyword sometimes. This filter adds the missing keyword.
- 10.times | Hello
Constant Summary collapse
- BLOCK_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/(\A(if|unless|else|elsif|when|in|begin|rescue|ensure|case)\b)|\bdo\s*(\|[^\|]*\|\s*)?\Z/
Instance Method Summary collapse
-
#on_slim_control(code, content) ⇒ Array
private
Handle control expression
[:slim, :control, code, content]
. -
#on_slim_output(escape, code, content) ⇒ Array
private
Handle output expression
[:slim, :output, escape, code, content]
.
Methods inherited from Filter
#on_slim_embedded, #on_slim_text
Instance Method Details
#on_slim_control(code, content) ⇒ 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 control expression [:slim, :control, code, content]
18 19 20 21 |
# File 'lib/slim/do_inserter.rb', line 18 def on_slim_control(code, content) code += ' do' unless code =~ BLOCK_REGEX || empty_exp?(content) [:slim, :control, code, compile(content)] end |
#on_slim_output(escape, code, content) ⇒ 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 output expression [:slim, :output, escape, code, content]
29 30 31 32 |
# File 'lib/slim/do_inserter.rb', line 29 def on_slim_output(escape, code, content) code += ' do' unless code =~ BLOCK_REGEX || empty_exp?(content) [:slim, :output, escape, code, compile(content)] end |