Class: CoderayString

Inherits:
String
  • Object
show all
Defined in:
lib/models/coderay_string.rb

Instance Method Summary collapse

Instance Method Details

#formatObject



2
3
4
5
6
7
8
# File 'lib/models/coderay_string.rb', line 2

def format
  content = self 
  content.scan(/(\[code\:([a-z].+?)\](.+?)\[\/code\])/m).each do |match|
    content.gsub!(match[0], CodeRay.scan(match[2].strip, match[1].to_sym).div({:css => :class}))
  end  
  return content
end