<commit_before>require 'triad'
module Surrounded
  module Context
    class InvalidRole < ::Triad::ItemNotPresent; end

    class RoleMap

      class << self
        def from_base(klass=::Triad)
          role_mapper = Class.new(::Surrounded::Context::RoleMap)
          num = __LINE__; role_mapper.class_eval %{
            def container
              @container ||= #{klass}.new
            end
          }, __FILE__, num
          %w{ update each values keys }.each do |meth|
            num = __LINE__; role_mapper.class_eval %{
              def #{meth}(*args, &block)
                container.send(:#{meth}, *args, &block)
              end
            }, __FILE__, num
          end
          role_mapper
        end
      end

      def role?(role)<commit_msg>be less verbose in subclassing role mapper<commit_after>require 'triad'
module Surrounded
  module Context
    class InvalidRole < ::Triad::ItemNotPresent; end

    class RoleMap

      class << self
        def from_base(klass=::Triad)
          role_mapper = Class.new(self)
          num = __LINE__; role_mapper.class_eval %{
            def container
              @container ||= #{klass}.new
            end
          }, __FILE__, num
          %w{ update each values keys }.each do |meth|
            num = __LINE__; role_mapper.class_eval %{
              def #{meth}(*args, &block)
                container.send(:#{meth}, *args, &block)
              end
            }, __FILE__, num
          end
          role_mapper
        end
      end

      def role?(role)
{'fraction_non_alphanumeric': 0.09980557355800389, 'fraction_numerical': 0.0, 'mean_word_length': 1.704028021015762, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3933034', 'n_tokens_mistral': 449, 'n_tokens_neox': 432, 'n_words': 113}