<commit_before>module Discourse
  module Oneboxer
    class GithubCommitOnebox < HandlebarsOnebox

      matcher /^https?:\/\/(?:www\.)?github\.com\/[^\/]+\/[^\/]+\/commit\/.+/
      favicon 'github.png'

      def translate_url
        m = @url.match(/github\.com\/(?<owner>[^\/]+)\/(?<repo>[^\/]+)\/commit\/(?<sha>[^\/]+)/mi)
        return "https://api.github.com/repos/#{m[:owner]}/#{m[:repo]}/commits/#{m[:sha]}" if m.present?
        @url
      end
<commit_msg>change m.present? to m.to_a.any? more accurate use for MatchData Object<commit_after>module Discourse
  module Oneboxer
    class GithubCommitOnebox < HandlebarsOnebox

      matcher /^https?:\/\/(?:www\.)?github\.com\/[^\/]+\/[^\/]+\/commit\/.+/
      favicon 'github.png'

      def translate_url
        m = @url.match(/github\.com\/(?<owner>[^\/]+)\/(?<repo>[^\/]+)\/commit\/(?<sha>[^\/]+)/mi)
        return "https://api.github.com/repos/#{m[:owner]}/#{m[:repo]}/commits/#{m[:sha]}" if m.to_a.any?
        @url
      end

{'fraction_non_alphanumeric': 0.2678751258811682, 'fraction_numerical': 0.0, 'mean_word_length': 2.5755395683453237, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4369803', 'n_tokens_mistral': 391, 'n_tokens_neox': 374, 'n_words': 51}