Class: Gitlab::GithubImport::MarkdownText

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/github_import/markdown_text.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, author, exists = false) ⇒ MarkdownText

text - The Markdown text as a String. author - An instance of `Gitlab::GithubImport::Representation::User` exists - Boolean that indicates the user exists in the GitLab database.


15
16
17
18
19
# File 'lib/gitlab/github_import/markdown_text.rb', line 15

def initialize(text, author, exists = false)
  @text = text
  @author = author
  @exists = exists
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author


6
7
8
# File 'lib/gitlab/github_import/markdown_text.rb', line 6

def author
  @author
end

#existsObject (readonly)

Returns the value of attribute exists


6
7
8
# File 'lib/gitlab/github_import/markdown_text.rb', line 6

def exists
  @exists
end

#textObject (readonly)

Returns the value of attribute text


6
7
8
# File 'lib/gitlab/github_import/markdown_text.rb', line 6

def text
  @text
end

Class Method Details

.format(*args) ⇒ Object


8
9
10
# File 'lib/gitlab/github_import/markdown_text.rb', line 8

def self.format(*args)
  new(*args).to_s
end

Instance Method Details

#to_sObject


21
22
23
24
25
26
27
# File 'lib/gitlab/github_import/markdown_text.rb', line 21

def to_s
  if exists
    text
  else
    "*Created by: #{author.}*\n\n#{text}"
  end
end