summaryrefslogtreecommitdiff
path: root/lib/category.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/category.rb')
-rw-r--r--lib/category.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/category.rb b/lib/category.rb
new file mode 100644
index 0000000..266da34
--- /dev/null
+++ b/lib/category.rb
@@ -0,0 +1,20 @@
+# coding: utf-8
+require 'config'
+
+class Category
+ def initialize(abbr)
+ @abbr = abbr
+ end
+ def abbr
+ @abbr
+ end
+ def name
+ Config::get.category_name(@abbr)
+ end
+ def html
+ return "<a class=\"tag #{abbr}\" href=\"/tags/#{abbr}.html\">#{name}</a>"
+ end
+ def atom
+ return "<category term=\"#{term}\" label=\"#{name}\" />"
+ end
+end