Class: Gitlab::GithubImport::MarkdownText

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

Constant Summary

Constants included from EncodingHelper

EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD, EncodingHelper::ESCAPED_CHARS, EncodingHelper::UNICODE_REPLACEMENT_CHARACTER

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EncodingHelper

#binary_io, #detect_binary?, #detect_encoding, #detect_libgit2_binary?, #encode!, #encode_binary, #encode_utf8, #encode_utf8_no_detect, #encode_utf8_with_replacement_character, #unquote_path

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.to_s
  @author = author
  @exists = exists
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
# File 'lib/gitlab/github_import/markdown_text.rb', line 21

def to_s
  # Gitlab::EncodingHelper#clean remove `null` chars from the string
  clean(format)
end