Class: Gitlab::GithubImport::Importer::NoteAttachmentsImporter
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Importer::NoteAttachmentsImporter
- Defined in:
- lib/gitlab/github_import/importer/note_attachments_importer.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#note_text ⇒ Object
readonly
Returns the value of attribute note_text.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(note_text, project, client) ⇒ NoteAttachmentsImporter
constructor
note_text - An instance of ‘Gitlab::GithubImport::Representation::NoteText`.
Constructor Details
#initialize(note_text, project, client) ⇒ NoteAttachmentsImporter
note_text - An instance of ‘Gitlab::GithubImport::Representation::NoteText`. project - An instance of `Project`. client - An instance of `Gitlab::GithubImport::Client`.
12 13 14 15 16 |
# File 'lib/gitlab/github_import/importer/note_attachments_importer.rb', line 12 def initialize(note_text, project, client) @note_text = note_text @project = project @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/gitlab/github_import/importer/note_attachments_importer.rb', line 7 def client @client end |
#note_text ⇒ Object (readonly)
Returns the value of attribute note_text.
7 8 9 |
# File 'lib/gitlab/github_import/importer/note_attachments_importer.rb', line 7 def note_text @note_text end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/gitlab/github_import/importer/note_attachments_importer.rb', line 7 def project @project end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gitlab/github_import/importer/note_attachments_importer.rb', line 18 def execute = MarkdownText.(note_text.text) return if .blank? new_text = .reduce(note_text.text) do |text, | new_url = () text.gsub(.url, new_url) end update_note_record(new_text) end |