<commit_before>require 'redditkit/subreddit'

module RedditKit
  class Client

    # Methods for interacting with subreddits.
    module Subreddits

      # Gets subreddits from a specified category.
      #
      # @option options [new, popular, banned] category The category of subreddits. Defaults to popular.
      # @option options [1..100] limit The number of subreddits to return.
      # @option options [String] before Only return subreddits before this id.
      # @option options [String] after Only return subreddits after this id.
      # @return [RedditKit::PaginatedResponse]
      def subreddits(options = {})
        options = options.clone

        category = options[:category] or 'popular'
        path = "reddits/#{category}.json"
        options.delete :category

        objects_from_response(:get, path, options)
      end

      # Gets the current user's subscribed subreddits.
      #
      # @option options [subscriber, contributor, moderator] category The category from which to return subreddits. Defaults to subscriber.
      # @option options [1..100] limit The number of subreddits to return.
      # @option options [String] before Only return subreddits before this id.
      # @option options [String] after Only return subreddits after this id.
      # @return [RedditKit::PaginatedResponse]
      def subscribed_subreddits(options = {})
        category = options[:category] or 'subscriber'
        path = "subreddits/mine/#{category}.json"
        options.delete :category

        objects_from_response(:get, path, options)
      end

      # Gets a subreddit object.
      #
      # @param subreddit_name [String] A subreddit's display name.
      # @return [RedditKit::Subreddit]
      # @example client.subreddit "programming"<commit_msg>Subreddits:subscribed_subreddits clone options before altering<commit_after>require 'redditkit/subreddit'

module RedditKit
  class Client

    # Methods for interacting with subreddits.
    module Subreddits

      # Gets subreddits from a specified category.
      #
      # @option options [new, popular, banned] category The category of subreddits. Defaults to popular.
      # @option options [1..100] limit The number of subreddits to return.
      # @option options [String] before Only return subreddits before this id.
      # @option options [String] after Only return subreddits after this id.
      # @return [RedditKit::PaginatedResponse]
      def subreddits(options = {})
        options = options.clone

        category = options[:category] or 'popular'
        path = "reddits/#{category}.json"
        options.delete :category

        objects_from_response(:get, path, options)
      end

      # Gets the current user's subscribed subreddits.
      #
      # @option options [subscriber, contributor, moderator] category The category from which to return subreddits. Defaults to subscriber.
      # @option options [1..100] limit The number of subreddits to return.
      # @option options [String] before Only return subreddits before this id.
      # @option options [String] after Only return subreddits after this id.
      # @return [RedditKit::PaginatedResponse]
      def subscribed_subreddits(options = {})
        options = options.clone

        category = options[:category] or 'subscriber'
        path = "subreddits/mine/#{category}.json"
        options.delete :category

        objects_from_response(:get, path, options)
      end

      # Gets a subreddit object.
      #
      # @param subreddit_name [String] A subreddit's display name.
      # @return [RedditKit::Subreddit]
      # @example client.subreddit "programming"
{'fraction_non_alphanumeric': 0.08424807903402853, 'fraction_numerical': 0.0043907793633369925, 'mean_word_length': 2.9792576419213974, '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': '5917610', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1004, 'n_words': 333}