<commit_before>module Modesty
  module DatastoreMethods
    def set_store(type, opts={})
      @store = case type.to_s
      when 'redis'
        require 'modesty/datastore/redis'
        Redis.new(opts)
      when 'mock'
        require 'modesty/datastore/mock_redis'
        MockRedis.new(opts)
      else
        puts "Unrecognized datastore #{type}.  Defaulting to MockRedis."
        self.set_store 'mock'
      end
    end

    def data
      @store ||= set_store 'mock'
    end
  end

  class << self
    include DatastoreMethods
  end
end<commit_msg>add support for Modesty.data=<commit_after>module Modesty
  module DatastoreMethods
    def set_store(type, opts={})
      @store = case type.to_s
      when 'redis'
        require 'modesty/datastore/redis'
        Redis.new(opts)
      when 'mock'
        require 'modesty/datastore/mock_redis'
        MockRedis.new(opts)
      else
        puts "Unrecognized datastore #{type}.  Defaulting to MockRedis."
        self.set_store 'mock'
      end
    end
    alias data= set_store

    def data
      @store ||= set_store 'mock'
    end
  end

  class << self
    include DatastoreMethods
  end
end
{'fraction_non_alphanumeric': 0.08549222797927461, 'fraction_numerical': 0.0, 'mean_word_length': 2.25561797752809, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2193241', 'n_tokens_mistral': 384, 'n_tokens_neox': 379, 'n_words': 95}