<commit_before>module Solid::Element

  def self.included(base)
    base.extend(ClassMethods)
    base.send(:include, InstanceMethods)
    base.send(:include, Solid::Iterable)
  end

  module InstanceMethods

    def initialize(tag_name, arguments_string, tokens)
       super
       @arguments = Solid::Arguments.parse(arguments_string)
    end

    def arguments
      @arguments
    end

    def with_context(context)
      @current_context = context
      yield
    ensure
      @current_context = nil
    end

    def current_context
      @current_context or raise Solid::ContextError.new("There is currently no context, do you forget to call render ?")
    end

    def display(*args)
      raise NotImplementedError.new("Solid::Element implementations SHOULD define a #display method")
    end
    
  end<commit_msg>Reset previous context instead of nil in Solid::Element#with_context<commit_after>module Solid::Element

  def self.included(base)
    base.extend(ClassMethods)
    base.send(:include, InstanceMethods)
    base.send(:include, Solid::Iterable)
  end

  module InstanceMethods

    def initialize(tag_name, arguments_string, tokens)
       super
       @arguments = Solid::Arguments.parse(arguments_string)
    end

    def arguments
      @arguments
    end

    def with_context(context)
      previous_context = @current_context
      @current_context = context
      yield
    ensure
      @current_context = previous_context
    end

    def current_context
      @current_context or raise Solid::ContextError.new("There is currently no context, do you forget to call render ?")
    end

    def display(*args)
      raise NotImplementedError.new("Solid::Element implementations SHOULD define a #display method")
    end
    
  end
{'fraction_non_alphanumeric': 0.07337883959044368, 'fraction_numerical': 0.0, 'mean_word_length': 3.2590799031476996, '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': '4970357', 'n_tokens_mistral': 497, 'n_tokens_neox': 465, 'n_words': 132}