diff options
-rw-r--r-- | lib/category.rb | 2 | ||||
-rw-r--r-- | lib/config.rb | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/category.rb b/lib/category.rb index e0ed8e0..8f14153 100644 --- a/lib/category.rb +++ b/lib/category.rb @@ -9,7 +9,7 @@ class Category @abbr.downcase end def name - Config::get.category_name(@abbr) + Config::get.category_name(abbr) end def html return "<a class=\"tag #{abbr}\" href=\"/tags/#{abbr}.html\">#{name}</a>" diff --git a/lib/config.rb b/lib/config.rb index 4690559..57e3b3f 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -42,10 +42,8 @@ class Config return @data['person_emails'][name] end # Categories - def categories - return @data['categories'].keys - end def category_name(abbr) - return @data['categories'][abbr] + @categories ||= (@data['categories'] || {}).map{|k,v|[k.downcase,v]}.to_h + return @categories[abbr.downcase] end end |