diff options
author | Alex Braha Stoll <alexbrahastoll@gmail.com> | 2017-01-30 01:07:31 -0200 |
---|---|---|
committer | Alex Braha Stoll <alexbrahastoll@gmail.com> | 2017-01-30 01:07:31 -0200 |
commit | 683097666aa01ef6a5b490be67a4a0d9733152e3 (patch) | |
tree | 08ef6a71de041dd2934ecf2056f4a4e9c4076620 /app/models/wiki_page.rb | |
parent | 4c57fa4282afc1679e2891b215174c92bf883c6a (diff) | |
download | gitlab-ce-683097666aa01ef6a5b490be67a4a0d9733152e3.tar.gz |
Add WikiPage.unhyphenize
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 20bd9719b2f..2f4f92846b4 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -34,6 +34,10 @@ class WikiPage flatten end + def self.unhyphenize(name) + name.gsub(/-+/, ' ') + end + def to_key [:slug] end @@ -78,7 +82,7 @@ class WikiPage # The formatted title of this page. def title if @attributes[:title] - @attributes[:title].gsub(/-+/, ' ') + self.class.unhyphenize(@attributes[:title]) else "" end |