Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ruval.rb

Instance Method Summary collapse

Instance Method Details

#remove_comments(padding) ⇒ Object



33
34
35
36
# File 'lib/ruval.rb', line 33

def remove_comments(padding)
  # not a perfect regex but good enough to detect most comments. eg it wont work for lines like "fun('#not a comment')"
  self.gsub(/ *#.*/, '').chop.ljust(padding) + ' # '
end