<commit_before>module Heroics
  # An HTTP client with methods mapped to API resources.
  class Client
    # Instantiate an HTTP client.
    #
    # @param resources [Hash<String,Resource>] A hash that maps method names
    #   to resources.
    def initialize(resources)
      @resources = resources
    end

    # Find a resource.
    #
    # @param name [String] The name of the resource to find.
    # @raise [NoMethodError] Raised if the name doesn't match a known resource.
    # @return [Resource] The resource matching the name.
    def method_missing(name)
      name = name.to_s.gsub('_', '-')
      resource = @resources[name]
      if resource.nil?
        # TODO(jkakar) Do we care about resource names in the schema specified
        # with underscores?  If so, we should check to make sure the name
        # mangling we did above was actually a bad idea.
        address = "<#{self.class.name}:0x00#{(self.object_id << 1).to_s(16)}>"
        raise NoMethodError.new("undefined method `#{name}' for ##{address}")
      end
      resource
    end
  end
<commit_msg>suppress the to_s on the Client object.<commit_after>module Heroics
  # An HTTP client with methods mapped to API resources.
  class Client
    # Instantiate an HTTP client.
    #
    # @param resources [Hash<String,Resource>] A hash that maps method names
    #   to resources.
    def initialize(resources)
      @resources = resources
    end

    # Find a resource.
    #
    # @param name [String] The name of the resource to find.
    # @raise [NoMethodError] Raised if the name doesn't match a known resource.
    # @return [Resource] The resource matching the name.
    def method_missing(name)
      name = name.to_s.gsub('_', '-')
      resource = @resources[name]
      if resource.nil?
        # TODO(jkakar) Do we care about resource names in the schema specified
        # with underscores?  If so, we should check to make sure the name
        # mangling we did above was actually a bad idea.
        address = "<#{self.class.name}:0x00#{(self.object_id << 1).to_s(16)}>"
        raise NoMethodError.new("undefined method `#{name}' for ##{address}")
      end
      resource
    end

    def inspect
      "#<Heroics::Client>"
    end

    alias to_s inspect
  end

{'fraction_non_alphanumeric': 0.09477413640389726, 'fraction_numerical': 0.005314437555358724, 'mean_word_length': 2.6612641815235007, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 8, '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': '880966', 'n_tokens_mistral': 664, 'n_tokens_neox': 648, 'n_words': 247}