<commit_before>require 'rom/relation/loaded'
require 'rom/relation/materializable'
require 'rom/pipeline'

module ROM
  class Relation
    # Left-to-right relation composition used for data-pipelining
    #
    # @api public
    class Composite < Pipeline::Composite
      include Materializable

      # Call the pipeline by passing results from left to right
      #
      # Optional args are passed to the left object
      #
      # @return [Loaded]
      #
      # @api public
      def call(*args)
        relation = left.call(*args)
        response = right.call(relation)

        if response.is_a?(Loaded)
          response
        elsif relation.is_a?(Loaded)
          relation.new(response)
        else
          Loaded.new(relation, response)
        end
      end
      alias_method :[], :call

      private

      # @api private
      #
      # @see Pipeline::Proxy#decorate?
      #
      # @api private
      def decorate?(response)
        super || response.is_a?(Graph)
      end
    end
  end
end<commit_msg>Simplify Relation::Composite#call<commit_after>require 'rom/relation/loaded'
require 'rom/relation/materializable'
require 'rom/pipeline'

module ROM
  class Relation
    # Left-to-right relation composition used for data-pipelining
    #
    # @api public
    class Composite < Pipeline::Composite
      include Materializable

      # Call the pipeline by passing results from left to right
      #
      # Optional args are passed to the left object
      #
      # @return [Loaded]
      #
      # @api public
      def call(*args)
        relation = left.call(*args)
        response = right.call(relation)

        if response.is_a?(Loaded)
          response
        else
          relation.new(response)
        end
      end
      alias_method :[], :call

      private

      # @api private
      #
      # @see Pipeline::Proxy#decorate?
      #
      # @api private
      def decorate?(response)
        super || response.is_a?(Graph)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08532934131736528, 'fraction_numerical': 0.0, 'mean_word_length': 2.028700906344411, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4719502', 'n_tokens_mistral': 571, 'n_tokens_neox': 566, 'n_words': 154}