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:



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

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

Instance Method Details

#add_text(src, text) ⇒ Object



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

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