<commit_before>module Mobylette
  module Controllers
    module Helpers
      extend ActiveSupport::Concern
      module InstanceMethods

        def mobylette_stylesheet_link_tag(*sources)
          if is_mobile_request?
            stylesheet_link_tag(*sulfix_mobile_assets(*sources, :css))
          else
            stylesheet_link_tag(*sources)
          end
        end

        def mobylette_javascript_include_tag(*sources)
          if is_mobile_request?
            javascript_include_tag(*sulfix_mobile_assets(*sources, :js))
          else
            javascript_include_tag(*sources)
          end
        end

        private

        def sulfix_mobile_assets(*sources, extension)
          sources.each_index do |index|
            source          = sources[index]
            source_mobile   = source.split(/.#{extension.to_s}$/)
            sources[index]  = "#{source_mobile[0]}_mobile"
            sources[index] += ".#{extension.to_s}" if source =~ /\.css$/
          end
          return *sources
        end
      end
    end
  end
end<commit_msg>Changing the html helpers so they act like the sprockets' ones<commit_after>module Mobylette
  module Controllers
    module Helpers
      extend ActiveSupport::Concern
      module InstanceMethods

        def mobylette_stylesheet_link_tag(source, options = {})
          if is_mobile_request?
            stylesheet_link_tag(sulfix_mobile_assets(source, :css), options)
          else
            stylesheet_link_tag(source, options)
          end
        end

        def mobylette_javascript_include_tag(source, options = {})
          if is_mobile_request?
            javascript_include_tag(sulfix_mobile_assets(source, :js), options)
          else
            javascript_include_tag(source, options)
          end
        end

        private

        def sulfix_mobile_assets(source, extension)
          if source =~ /.#{extension}$/
            "#{source.split(/.#{extension}$/)[0]}_mobile.#{extension}"
          else
            "#{source}_mobile"
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07873259721555449, 'fraction_numerical': 0.0009601536245799327, 'mean_word_length': 2.0334788937409023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6798159', 'n_tokens_mistral': 580, 'n_tokens_neox': 564, 'n_words': 117}