class Growi::ImageConverter::MarkdownImage

Markdown syntax image

Attributes

syntax[RW]
url[RW]

Public Class Methods

new(syntax) click to toggle source
# File lib/growi/image_converter/markdown_image.rb, line 7
def initialize(syntax)
  match = syntax.match(%r{(?<url>https?://.*?)(?:\s+?|"|\)|$)})

  @syntax = syntax
  @url = match&.[](:url)
end

Public Instance Methods

replace_url(new_url) click to toggle source
# File lib/growi/image_converter/markdown_image.rb, line 15
def replace_url(new_url)
  syntax.sub url, new_url
end