Testing Ruby Syntax

Ruby code posted
created at 11 Aug 22:59

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
module CommentsHelper
  def format_comment(content)
    simple_format(keep_spaces_at_beginning(h(content)))
  end
  
  def keep_spaces_at_beginning(content)
    content.split("\n").map do |line|
      line.sub(/^ +/) do |spaces|
        ' ' * spaces.length
      end
    end.join("\n")
  end
end
314 Bytes in 4 ms with coderay