<commit_before>module StoryGem
  class Base
    attr_reader :attrs
    alias to_hash attrs

    # Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key
    #
    # @overload self.attr_reader(attr)
    #   @param attr [Symbol]
    # @overload self.attr_reader(attrs)
    #   @param attrs [Array<Symbol>]
    def self.attr_reader(*attrs)
      attrs.each do |attribute|
        class_eval do
          define_method attribute do
            @attrs[attribute.to_sym]
          end
        end
      end
    end

    def initialize(attrs={})
      @attrs = {}
      attrs.each do |k,v|
        @attrs[k.to_sym] = v
      end
    end

    def self.fetch_or_new(attrs={})
      return unless attrs
      return new(attrs)
    end

    def self.from_response(response={})
      fetch_or_new(parsed(response))
    end

    def parsed response
      if response.respond_to? :parsed
        response.parsed
      elsif response.respond_to? :parsed_response
        response.parsed_response
      end
    end

  end
end
<commit_msg>fixed calendar creation<commit_after>module StoryGem
  class Base
    attr_reader :attrs
    alias to_hash attrs

    # Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key
    #
    # @overload self.attr_reader(attr)
    #   @param attr [Symbol]
    # @overload self.attr_reader(attrs)
    #   @param attrs [Array<Symbol>]
    def self.attr_reader(*attrs)
      attrs.each do |attribute|
        class_eval do
          define_method attribute do
            @attrs[attribute.to_sym]
          end
        end
      end
    end

    def initialize(attrs={})
      @attrs = {}
      attrs.each do |k,v|
        @attrs[k.to_sym] = v
      end
    end

    def self.fetch_or_new(attrs={})
      return unless attrs
      return new(attrs)
    end

    def self.from_response(response={})
      fetch_or_new(parsed(response))
    end

    def self.parsed response
      if response.respond_to? :parsed
        response.parsed
      elsif response.respond_to? :parsed_response
        response.parsed_response
      end
    end

  end
end

{'fraction_non_alphanumeric': 0.07593189139438564, 'fraction_numerical': 0.0, 'mean_word_length': 2.2255192878338277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4401107', 'n_tokens_mistral': 649, 'n_tokens_neox': 651, 'n_words': 180}