Class: Rehab::DoFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/rehab/do_filter.rb

Constant Summary collapse

BLOCK_REGEX =
/(\A(if|unless|else|elsif|when|begin|rescue|ensure|case|end)\b)|do\s*(\|[^\|]*\|\s*)?\Z/

Instance Method Summary collapse

Instance Method Details

#on_rehab_control(code) ⇒ Object



5
6
7
8
# File 'lib/rehab/do_filter.rb', line 5

def on_rehab_control(code)
	code = code + ' do' unless code =~ BLOCK_REGEX
	[:rehab, :control, code]
end