<commit_before>module Tuxedo
  module ActionView
    # Main module for the ActionView helpers
    #
    # @example
    #
    #   presenter_for(instance)
    #
    #   prac(instance, method, *args)
    #
    module Helpers
      # We can use this to give a block and wrap all the presenter methods
      # in the block. This shows clearly that we are using a presenter
      # without the explicit assign statement. Some magic happens to initiate
      # a new presenter with the model and the view context
      #
      # @param model[Object] any type of object that needs to be presented
      # @param klass [KlassName] a different presenter klass
      # @return model presenter instance
      #
      def presenter_for(model, klass = nil)
        return if model.nil?
        klass ||= "#{model.class.name}#{Tuxedo.config.suffix}".constantize
        presenter = klass.new(model, self)
        yield presenter if block_given?
        presenter
      end

      # Present And Call
      # Shorthand method for using the following call
      #
      #   presenter_for(object).zone_label
      #
      # @example
      #
      #   prac object :zone_label
      #
      # @param object [Object]
      # @param method [method] the method we should call on the presentor
      # @param args [Hash] optional arguments for the method
      #
      def prac(object, method, *args)
        return if object.nil? || method.nil?
        presenter_for(object).send(method.to_sym, *args)
      end
    end
  end
end<commit_msg>Fix missing comma in #prac example<commit_after>module Tuxedo
  module ActionView
    # Main module for the ActionView helpers
    #
    # @example
    #
    #   presenter_for(instance)
    #
    #   prac(instance, method, *args)
    #
    module Helpers
      # We can use this to give a block and wrap all the presenter methods
      # in the block. This shows clearly that we are using a presenter
      # without the explicit assign statement. Some magic happens to initiate
      # a new presenter with the model and the view context
      #
      # @param model[Object] any type of object that needs to be presented
      # @param klass [KlassName] a different presenter klass
      # @return model presenter instance
      #
      def presenter_for(model, klass = nil)
        return if model.nil?
        klass ||= "#{model.class.name}#{Tuxedo.config.suffix}".constantize
        presenter = klass.new(model, self)
        yield presenter if block_given?
        presenter
      end

      # Present And Call
      # Shorthand method for using the following call
      #
      #   presenter_for(object).zone_label
      #
      # @example
      #
      #   prac object, :zone_label
      #
      # @param object [Object]
      # @param method [method] the method we should call on the presentor
      # @param args [Hash] optional arguments for the method
      #
      def prac(object, method, *args)
        return if object.nil? || method.nil?
        presenter_for(object).send(method.to_sym, *args)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07329842931937172, 'fraction_numerical': 0.0, 'mean_word_length': 2.2590618336886994, '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': '226276', 'n_tokens_mistral': 862, 'n_tokens_neox': 870, 'n_words': 312}