Module: CaptainsLog::CaptainsLogHelper

Defined in:
app/helpers/captains_log/captains_log_helper.rb

Instance Method Summary collapse

Instance Method Details

#captains_log(post) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/captains_log/captains_log_helper.rb', line 3

def captains_log(post)
  array = post.scan(/(?:\<eval\>)(.*?)(?:\<\/eval\>)/)
  @logged = []
  array.each do |a|
    @logged << eval(a[0])
  end
  post.gsub(/(?:\<eval\>)(.*?)(?:\<\/eval\>)/).with_index { |match, i| "#{@logged[i]}" }
end