class Fastlane::Helper::SlackBotLinkFormatterHelper

Fastlane is moving away 'slack-notifier' gem, github.com/fastlane/fastlane/pull/18512 Duplicate of: github.com/stevenosloan/slack-notifier/blob/master/lib/slack-notifier/util/link_formatter.rb

Constants

HTML_PATTERN

rubular.com/r/19cNXW5qbH

MARKDOWN_PATTERN

Attempt at only matching pairs of parens per the markdown spec spec.commonmark.org/0.27/#links

rubular.com/r/y107aevxqT

VALID_PATH_CHARS

the path portion of a url can contain these characters

Attributes

formats[R]

Public Class Methods

format(string, opts={}) click to toggle source
# File lib/fastlane/plugin/slack_bot/helper/slack_bot_link_formatter_helper.rb, line 34
def format string, opts={}
  SlackBotLinkFormatterHelper.new(string, **opts).formatted
end
new(string, opts = {}) click to toggle source
# File lib/fastlane/plugin/slack_bot/helper/slack_bot_link_formatter_helper.rb, line 41
def initialize string, opts = {}
  @formats = opts[:formats] || %i[html markdown]
  @orig    = string.respond_to?(:scrub) ? string.scrub : string
end

Public Instance Methods

formatted() click to toggle source

rubocop:disable Lint/RescueWithoutErrorClass

# File lib/fastlane/plugin/slack_bot/helper/slack_bot_link_formatter_helper.rb, line 47
def formatted
  return @orig unless @orig.respond_to?(:gsub)

  sub_markdown_links(sub_html_links(@orig))
rescue => e
  raise e unless RUBY_VERSION < "2.1" && e.message.include?("invalid byte sequence")
  raise e, "#{e.message}. Consider including the 'string-scrub' gem to strip invalid characters"
end

Private Instance Methods