Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/wiki_page.rb')
-rw-r--r--lib/gitlab/git/wiki_page.rb34
1 files changed, 24 insertions, 10 deletions
diff --git a/lib/gitlab/git/wiki_page.rb b/lib/gitlab/git/wiki_page.rb
index a1f3d64ccde..57b7e7d53dd 100644
--- a/lib/gitlab/git/wiki_page.rb
+++ b/lib/gitlab/git/wiki_page.rb
@@ -5,17 +5,31 @@ module Gitlab
class WikiPage
attr_reader :url_path, :title, :format, :path, :version, :raw_data, :name, :historical, :formatted_data
- # This class abstracts away Gitlab::GitalyClient::WikiPage
- def initialize(gitaly_page, version)
- @url_path = gitaly_page.url_path
- @title = gitaly_page.title
- @format = gitaly_page.format
- @path = gitaly_page.path
- @raw_data = gitaly_page.raw_data
- @name = gitaly_page.name
- @historical = gitaly_page.historical?
+ class << self
+ # Abstracts away Gitlab::GitalyClient::WikiPage
+ def from_gitaly_wiki_page(gitaly_page, version)
+ new(
+ url_path: gitaly_page.url_path,
+ title: gitaly_page.title,
+ format: gitaly_page.format,
+ path: gitaly_page.path,
+ raw_data: gitaly_page.raw_data,
+ name: gitaly_page.name,
+ historical: gitaly_page.historical?,
+ version: version
+ )
+ end
+ end
- @version = version
+ def initialize(hash)
+ @url_path = hash[:url_path]
+ @title = hash[:title]
+ @format = hash[:format]
+ @path = hash[:path]
+ @raw_data = hash[:raw_data]
+ @name = hash[:name]
+ @historical = hash[:historical]
+ @version = hash[:version]
end
def historical?