<commit_before>require "pling/version"

module Pling

  autoload :Device,  'pling/device'
  autoload :Message, 'pling/message'
  autoload :Gateway, 'pling/gateway'

  @gateways = []

  class Error < StandardError
  end

  class AuthenticationFailed < Error
  end

  class DeliveryFailed < Error
  end

  class << self
    ##
    # Stores the list of available gateway instances
    #
    # @return [Array] list of available gateways
    attr_accessor :gateways

    def configure
      raise ArgumentError, 'No block given for Pling.configure' unless block_given?
      yield self
    end


    ##
    # [INTERNAL METHOD] Converts the given object to the given pling type
    #
    # @private
    # @param object [Object] The object that needs to be converted
    # @param type [Symbol, String] #to_pling_ method suffix
    # @raise [ArgumentError] The object does not implement a #to_pling_ + type method
    def _convert(object, type)
      method = :"to_pling_#{type}"
      raise ArgumentError, "Instances of #{object.class} do not implement ##{method}" unless object.respond_to?(method)
      object && object.send(method)
    end
  end

end<commit_msg>Added documentation for Pling.configure<commit_after>require "pling/version"

module Pling

  autoload :Device,  'pling/device'
  autoload :Message, 'pling/message'
  autoload :Gateway, 'pling/gateway'

  @gateways = []

  class Error < StandardError
  end

  class AuthenticationFailed < Error
  end

  class DeliveryFailed < Error
  end

  class << self
    ##
    # Stores the list of available gateway instances
    #
    # @return [Array] list of available gateways
    attr_accessor :gateways


    ##
    # Allows configuration of Pling by passing a config object to the given block
    #
    # @yield [config]
    # @raise [ArgumentError] Raised when no block is given
    def configure
      raise ArgumentError, 'No block given for Pling.configure' unless block_given?
      yield self
    end


    ##
    # [INTERNAL METHOD] Converts the given object to the given pling type
    #
    # @private
    # @param object [Object] The object that needs to be converted
    # @param type [Symbol, String] #to_pling_ method suffix
    # @raise [ArgumentError] The object does not implement a #to_pling_ + type method
    def _convert(object, type)
      method = :"to_pling_#{type}"
      raise ArgumentError, "Instances of #{object.class} do not implement ##{method}" unless object.respond_to?(method)
      object && object.send(method)
    end
  end

end
{'fraction_non_alphanumeric': 0.08296943231441048, 'fraction_numerical': 0.0, 'mean_word_length': 3.172185430463576, 'pattern_counts': {'":': 0, '<': 13, '<?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': '857106', 'n_tokens_mistral': 754, 'n_tokens_neox': 726, 'n_words': 261}