summaryrefslogtreecommitdiff
path: root/app/models/snippet.rb
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-20 22:00:00 +0300
committergitlabhq <m@gitlabhq.com>2011-10-20 22:00:00 +0300
commitc463eeb0908e5c00008073c07e71e06434393342 (patch)
treede9e958048e0d7e148d8e85bd5512339aca3ec1f /app/models/snippet.rb
parent48924dfeeafbe965ec06797b10010ebd8a5dcfcd (diff)
downloadgitlab-ce-c463eeb0908e5c00008073c07e71e06434393342.tar.gz
refactoring
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r--app/models/snippet.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 0a54fee7e2f..119b69a4525 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -1,4 +1,6 @@
class Snippet < ActiveRecord::Base
+ include Utils::Colorize
+
belongs_to :project
belongs_to :author, :class_name => "User"
has_many :notes, :as => :noteable
@@ -28,6 +30,11 @@ class Snippet < ActiveRecord::Base
".js", ".sh", ".coffee", ".yml", ".md"
]
end
+
+ def colorize
+ ft = handle_file_type(file_name)
+ Albino.colorize(content, ft, :html, 'utf-8', "linenos=True")
+ end
end
# == Schema Information
#