Module: Erubis::NoTextEnhancer

Included in:
NoTextEruby
Defined in:
lib/erubis/enhancer.rb

Overview

remove text and leave code, especially useful when debugging.

ex.

$ erubis -s -E NoText file.eruby | more

this is language independent.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descObject

:nodoc:



278
279
280
# File 'lib/erubis/enhancer.rb', line 278

def self.desc   # :nodoc:
  "remove text and leave code (useful when debugging)"
end

Instance Method Details

#add_text(src, text) ⇒ Object



282
283
284
285
286
287
288
# File 'lib/erubis/enhancer.rb', line 282

def add_text(src, text)
  src << ("\n" * text.count("\n"))
  if text[-1] != ?\n
    text =~ /^(.*?)\z/
    src << (' ' * $1.length)
  end
end