diff --git a/src/benchmark.cr b/src/benchmark.cr index 59cad44ba13e..a581af2ad23b 100644 --- a/src/benchmark.cr +++ b/src/benchmark.cr @@ -3,6 +3,8 @@ require "./benchmark/**" # The Benchmark module provides methods for benchmarking Crystal code, giving # detailed reports on the time and memory taken for each task. # +# NOTE: To use `Benchmark`, you must explicitly import it with `require "benchmark"` +# # ### Measure the number of iterations per second of each task # # ``` diff --git a/src/big/big_decimal.cr b/src/big/big_decimal.cr index b5d9e93f2d29..470c61e3e85f 100644 --- a/src/big/big_decimal.cr +++ b/src/big/big_decimal.cr @@ -12,6 +12,8 @@ end # Value contains the actual value, and scale tells the decimal point place. # E.g. when value is `1234` and scale `2`, the result is `12.34`. # +# NOTE: To use `BigDecimal`, you must explicitly import it with `require "big"` +# # The general idea and some of the arithmetic algorithms were adapted from # the MIT/APACHE-licensed [bigdecimal-rs](https://github.com/akubera/bigdecimal-rs). struct BigDecimal < Number diff --git a/src/big/big_float.cr b/src/big/big_float.cr index 7c90a6985207..cc455c7c56cd 100644 --- a/src/big/big_float.cr +++ b/src/big/big_float.cr @@ -4,6 +4,8 @@ require "big" # A `BigFloat` can represent arbitrarily large floats. # # It is implemented under the hood with [GMP](https://gmplib.org/). +# +# NOTE: To use `BigFloat`, you must explicitly import it with `require "big"` struct BigFloat < Float include Comparable(Int) include Comparable(BigFloat) diff --git a/src/big/big_int.cr b/src/big/big_int.cr index aaae48999938..e1ca94dbd10b 100644 --- a/src/big/big_int.cr +++ b/src/big/big_int.cr @@ -5,6 +5,8 @@ require "random" # A `BigInt` can represent arbitrarily large integers. # # It is implemented under the hood with [GMP](https://gmplib.org/). +# +# NOTE: To use `BigInt`, you must explicitly import it with `require "big"` struct BigInt < Int include Comparable(Int::Signed) include Comparable(Int::Unsigned) diff --git a/src/big/big_rational.cr b/src/big/big_rational.cr index c87273788fef..acb34838ca3f 100644 --- a/src/big/big_rational.cr +++ b/src/big/big_rational.cr @@ -5,6 +5,8 @@ require "big" # denominator and the numerator have no common factors, and that the # denominator is positive. Zero has the unique representation 0/1. # +# NOTE: To use `BigRational`, you must explicitly import it with `require "big"` +# # ``` # require "big" # diff --git a/src/bit_array.cr b/src/bit_array.cr index 080c8475765b..4f4eb5726055 100644 --- a/src/bit_array.cr +++ b/src/bit_array.cr @@ -4,6 +4,8 @@ # `UInt32`s. The total number of bits stored is set at creation and is # immutable. # +# NOTE: To use `BitArray`, you must explicitly import it with `require "bit_array"` +# # ### Example # # ``` diff --git a/src/colorize.cr b/src/colorize.cr index 8cdd6648e8ff..4fee40faf616 100644 --- a/src/colorize.cr +++ b/src/colorize.cr @@ -3,6 +3,8 @@ # as its main interface, which calls `to_s` and surrounds it with the necessary escape codes # when it comes to obtaining a string representation of the object. # +# NOTE: To use `Colorize`, you must explicitly import it with `require "colorize"` +# # Its first argument changes the foreground color: # # ``` diff --git a/src/complex.cr b/src/complex.cr index 6fd1d2a2faf2..d4e648e9c8fe 100644 --- a/src/complex.cr +++ b/src/complex.cr @@ -3,6 +3,8 @@ # The a is the real part of the number, and the b is the imaginary part of # the number. # +# NOTE: To use `Complex`, you must explicitly import it with `require "complex"` +# # ``` # require "complex" # diff --git a/src/compress/deflate/deflate.cr b/src/compress/deflate/deflate.cr index 4c6ee0cdc145..58479f503fbf 100644 --- a/src/compress/deflate/deflate.cr +++ b/src/compress/deflate/deflate.cr @@ -6,6 +6,8 @@ require "./*" # # See `Gzip`, `Zip` and `Zlib` for modules that provide access # to DEFLATE-based file formats. +# +# NOTE: To use `Deflate` or its children, you must explicitly import it with `require "compress/deflate"` module Compress::Deflate NO_COMPRESSION = 0 BEST_SPEED = 1 diff --git a/src/compress/gzip/gzip.cr b/src/compress/gzip/gzip.cr index 616c25422a05..2d8ffcd81338 100644 --- a/src/compress/gzip/gzip.cr +++ b/src/compress/gzip/gzip.cr @@ -3,6 +3,8 @@ require "digest/crc32" # The Gzip module contains readers and writers of gzip format compressed # data, as specified in [RFC 1952](https://www.ietf.org/rfc/rfc1952.txt). +# +# NOTE: To use `Gzip` or its children, you must explicitly import it with `require "compress/gzip"` module Compress::Gzip NO_COMPRESSION = Compress::Deflate::NO_COMPRESSION BEST_SPEED = Compress::Deflate::BEST_SPEED diff --git a/src/compress/zip/zip.cr b/src/compress/zip/zip.cr index 61da653dabec..ec03826fcba8 100644 --- a/src/compress/zip/zip.cr +++ b/src/compress/zip/zip.cr @@ -4,6 +4,8 @@ require "digest/crc32" # The Compress::Zip module contains readers and writers of the zip # file format, described at [PKWARE's site](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT). # +# NOTE: To use `Zip` or its children, you must explicitly import it with `require "compress/zip"` +# # ### Reading zip files # # Two types are provided to read from zip files: diff --git a/src/compress/zlib/zlib.cr b/src/compress/zlib/zlib.cr index b996c825e742..0326f24bf815 100644 --- a/src/compress/zlib/zlib.cr +++ b/src/compress/zlib/zlib.cr @@ -3,6 +3,8 @@ require "digest/adler32" # The Compress::Zlib module contains readers and writers of zlib format compressed # data, as specified in [RFC 1950](https://www.ietf.org/rfc/rfc1950.txt). +# +# NOTE: To use `Zlib` or its children, you must explicitly import it with `require "compress/zlib"` module Compress::Zlib NO_COMPRESSION = Compress::Deflate::NO_COMPRESSION BEST_SPEED = Compress::Deflate::BEST_SPEED diff --git a/src/crypto/bcrypt.cr b/src/crypto/bcrypt.cr index 28c36bef647c..92d90495c1df 100644 --- a/src/crypto/bcrypt.cr +++ b/src/crypto/bcrypt.cr @@ -29,6 +29,8 @@ require "./subtle" # Last but not least: beware of denial of services! Always protect your # application using an external strategy (eg: rate limiting), otherwise # endpoints that verifies bcrypt hashes will be an easy target. +# +# NOTE: To use `Bcrypt`, you must explicitly import it with `require "crypto/bcrypt"` class Crypto::Bcrypt class Error < Exception end diff --git a/src/crypto/bcrypt/password.cr b/src/crypto/bcrypt/password.cr index 234ac5c1918a..b98658c9e22f 100644 --- a/src/crypto/bcrypt/password.cr +++ b/src/crypto/bcrypt/password.cr @@ -3,6 +3,8 @@ require "../subtle" # Generate, read and verify `Crypto::Bcrypt` hashes. # +# NOTE: To use `Password`, you must explicitly import it with `require "crypto/bcrypt/password"` +# # ``` # require "crypto/bcrypt/password" # diff --git a/src/csv.cr b/src/csv.cr index 92fdd4f4dd87..d01da95ff138 100644 --- a/src/csv.cr +++ b/src/csv.cr @@ -3,6 +3,8 @@ # # This module conforms to [RFC 4180](https://tools.ietf.org/html/rfc4180). # +# NOTE: To use `CSV` or its children, you must explicitly import it with `require "csv"` +# # ### Parsing # # Several ways of parsing CSV are provided. The most straight-forward, but diff --git a/src/digest/adler32.cr b/src/digest/adler32.cr index 110eb9a8684e..0b31e52a80b1 100644 --- a/src/digest/adler32.cr +++ b/src/digest/adler32.cr @@ -2,6 +2,8 @@ require "lib_z" require "./digest" # Implements the Adler32 checksum algorithm. +# +# NOTE: To use `Adler32`, you must explicitly import it with `require "digest/adler32"` class Digest::Adler32 < ::Digest extend ClassMethods diff --git a/src/digest/crc32.cr b/src/digest/crc32.cr index 07432f455a69..b32ecd68e41f 100644 --- a/src/digest/crc32.cr +++ b/src/digest/crc32.cr @@ -2,6 +2,8 @@ require "lib_z" require "./digest" # Implements the CRC32 checksum algorithm. +# +# NOTE: To use `CRC32`, you must explicitly import it with `require "digest/crc32"` class Digest::CRC32 < ::Digest extend ClassMethods diff --git a/src/digest/md5.cr b/src/digest/md5.cr index 35a4247d0baa..15f74b3e0b95 100644 --- a/src/digest/md5.cr +++ b/src/digest/md5.cr @@ -3,6 +3,8 @@ require "openssl" # Implements the MD5 digest algorithm. # +# NOTE: To use `MD5`, you must explicitly import it with `require "digest/md5"` +# # WARNING: MD5 is no longer a cryptographically secure hash, and should not be # used in security-related components, like password hashing. For passwords, see # `Crypto::Bcrypt::Password`. For a generic cryptographic hash, use SHA-256 via diff --git a/src/digest/sha1.cr b/src/digest/sha1.cr index b777cb55f7fb..01d96ce00bc0 100644 --- a/src/digest/sha1.cr +++ b/src/digest/sha1.cr @@ -3,6 +3,8 @@ require "openssl" # Implements the SHA1 digest algorithm. # +# NOTE: To use `SHA1`, you must explicitly import it with `require "digest/sha1"` +# # WARNING: SHA1 is no longer a cryptographically secure hash, and should not be # used in security-related components, like password hashing. For passwords, see # `Crypto::Bcrypt::Password`. For a generic cryptographic hash, use SHA-256 via diff --git a/src/digest/sha256.cr b/src/digest/sha256.cr index 93606091aca5..4c4cc882b667 100644 --- a/src/digest/sha256.cr +++ b/src/digest/sha256.cr @@ -2,6 +2,8 @@ require "./digest" require "openssl" # Implements the SHA256 digest algorithm. +# +# NOTE: To use `SHA256`, you must explicitly import it with `require "digest/sha256"` class Digest::SHA256 < ::OpenSSL::Digest extend ClassMethods diff --git a/src/digest/sha512.cr b/src/digest/sha512.cr index fe517e7cc2b1..f6364e4db5aa 100644 --- a/src/digest/sha512.cr +++ b/src/digest/sha512.cr @@ -2,6 +2,8 @@ require "./digest" require "openssl" # Implements the SHA512 digest algorithm. +# +# NOTE: To use `SHA256`, you must explicitly import it with `require "digest/sha512"` class Digest::SHA512 < ::OpenSSL::Digest extend ClassMethods diff --git a/src/ecr.cr b/src/ecr.cr index 86ccd035911b..42bee548b22c 100644 --- a/src/ecr.cr +++ b/src/ecr.cr @@ -16,6 +16,8 @@ # tag: `<%# hello %>`. An ECR tag can be inserted directly (i.e. the tag itself may be # escaped) by using a second `%` like so: `<%% a = b %>` or `<%%= foo %>`. # +# NOTE: To use `ECR`, you must explicitly import it with `require "ecr"` +# # Quick Example: # # Create a simple ECR file named `greeter.ecr`: diff --git a/src/file_utils.cr b/src/file_utils.cr index 21c3041cfc74..ad189ecd0b25 100644 --- a/src/file_utils.cr +++ b/src/file_utils.cr @@ -1,3 +1,4 @@ +# NOTE: To use `FileUtils`, you must explicitly import it with `require "file_utils"` module FileUtils extend self diff --git a/src/html.cr b/src/html.cr index 703d3fb47579..49457b1f1e29 100644 --- a/src/html.cr +++ b/src/html.cr @@ -3,6 +3,8 @@ require "./html/entities" # Provides HTML escaping and unescaping methods. # # For HTML *parsing* see module XML, especially `XML.parse_html`. +# +# NOTE: To use `HTML`, you must explicitly import it with `require "html"` module HTML private SUBSTITUTIONS = { '&' => "&", diff --git a/src/http.cr b/src/http.cr index 4be21ed52404..29dd9faf94b9 100644 --- a/src/http.cr +++ b/src/http.cr @@ -5,5 +5,7 @@ require "./http/log" require "./http/common" # The HTTP module contains `HTTP::Client`, `HTTP::Server` and `HTTP::WebSocket` implementations. +# +# NOTE: To use `HTTP`, you must explicitly import it with `require "http"` module HTTP end diff --git a/src/http/client.cr b/src/http/client.cr index c9b9e1d699da..41bfa70e68ed 100644 --- a/src/http/client.cr +++ b/src/http/client.cr @@ -4,6 +4,8 @@ # An HTTP Client. # +# NOTE: To use `Client`, you must explicitly import it with `require "http/client"` +# # ### One-shot usage # # Without a block, an `HTTP::Client::Response` is returned and the response's body diff --git a/src/http/cookie.cr b/src/http/cookie.cr index 5b672ca2238a..83b41297707e 100644 --- a/src/http/cookie.cr +++ b/src/http/cookie.cr @@ -2,6 +2,8 @@ require "./common" module HTTP # Represents a cookie with all its attributes. Provides convenient access and modification of them. + # + # NOTE: To use `Cookie`, you must explicitly import it with `require "http/cookie"` class Cookie # Possible values for the `SameSite` cookie as described in the [Same-site Cookies Draft](https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1). enum SameSite @@ -273,6 +275,8 @@ module HTTP # Represents a collection of cookies as it can be present inside # a HTTP request or response. + # + # NOTE: To use `Cookies`, you must explicitly import it with `require "http/cookie"` class Cookies include Enumerable(Cookie) diff --git a/src/http/formdata.cr b/src/http/formdata.cr index 433ee494b3de..267442687864 100644 --- a/src/http/formdata.cr +++ b/src/http/formdata.cr @@ -4,6 +4,8 @@ require "mime/multipart" # Contains utilities for parsing `multipart/form-data` messages, which are # commonly used for encoding HTML form data. # +# NOTE: To use `FormData`, you must explicitly import it with `require "http"` +# # ### Examples # # Commonly, you'll want to parse a from response from a HTTP request, and diff --git a/src/http/headers.cr b/src/http/headers.cr index f3ad07d402c5..61e04881c1a9 100644 --- a/src/http/headers.cr +++ b/src/http/headers.cr @@ -2,6 +2,8 @@ # # Two headers are considered the same if their downcase representation is the same # (in which `_` is the downcase version of `-`). +# +# NOTE: To use `Headers`, you must explicitly import it with `require "http/headers"` struct HTTP::Headers include Enumerable({String, Array(String)}) diff --git a/src/http/request.cr b/src/http/request.cr index 9a01daeab437..c6a72d3469c0 100644 --- a/src/http/request.cr +++ b/src/http/request.cr @@ -12,6 +12,8 @@ require "socket" # When creating a request with a `String` or `Bytes` its body # will be a `IO::Memory` wrapping these, and the `Content-Length` # header will be set appropriately. +# +# NOTE: To use `Request`, you must explicitly import it with `require "http/request"` class HTTP::Request property method : String property headers : Headers diff --git a/src/http/server.cr b/src/http/server.cr index 1a6e7d8d8733..6e44f4150582 100644 --- a/src/http/server.cr +++ b/src/http/server.cr @@ -15,6 +15,8 @@ require "log" # A server is initialized with a handler chain responsible for processing each # incoming request. # +# NOTE: To use `Server`, you must explicitly import it with `require "http/server"` +# # ``` # require "http/server" # diff --git a/src/http/server/handler.cr b/src/http/server/handler.cr index 3b1f97113b80..792879fc949d 100644 --- a/src/http/server/handler.cr +++ b/src/http/server/handler.cr @@ -4,6 +4,8 @@ require "./context" # You can use a handler to intercept any incoming request and can modify the response. # These can be used for request throttling, ip-based filtering, adding custom headers e.g. # +# NOTE: To use `Handler`, you must explicitly import it with `require "http/server/handler"` +# # ### A custom handler # # ``` diff --git a/src/http/server/handlers/compress_handler.cr b/src/http/server/handlers/compress_handler.cr index 8dd5e66c4404..e059b697649c 100644 --- a/src/http/server/handlers/compress_handler.cr +++ b/src/http/server/handlers/compress_handler.cr @@ -5,6 +5,8 @@ # A handler that configures an `HTTP::Server::Response` to compress the response # output, either using gzip or deflate, depending on the `Accept-Encoding` request header. +# +# NOTE: To use `CompressHandler`, you must explicitly import it with `require "http"` class HTTP::CompressHandler include HTTP::Handler diff --git a/src/http/server/handlers/error_handler.cr b/src/http/server/handlers/error_handler.cr index 6036b0d9536e..f92b1a8d0c7a 100644 --- a/src/http/server/handlers/error_handler.cr +++ b/src/http/server/handlers/error_handler.cr @@ -6,6 +6,8 @@ # # This handler also logs the exceptions to the specified logger or # the logger for the source "http.server" by default. +# +# NOTE: To use `ErrorHandler`, you must explicitly import it with `require "http"` class HTTP::ErrorHandler include HTTP::Handler diff --git a/src/http/server/handlers/log_handler.cr b/src/http/server/handlers/log_handler.cr index eb29fd7d1595..6aa82f6d911a 100644 --- a/src/http/server/handlers/log_handler.cr +++ b/src/http/server/handlers/log_handler.cr @@ -2,6 +2,8 @@ require "log" # A handler that logs the request method, resource, status code, and # the time used to execute the next handler +# +# NOTE: To use `LogHandler`, you must explicitly import it with `require "http"` class HTTP::LogHandler include HTTP::Handler diff --git a/src/http/server/handlers/static_file_handler.cr b/src/http/server/handlers/static_file_handler.cr index d38b462e7a3e..3fbb57ab0bc0 100644 --- a/src/http/server/handlers/static_file_handler.cr +++ b/src/http/server/handlers/static_file_handler.cr @@ -8,6 +8,8 @@ require "mime" # This handler can send precompressed content, if the client accepts it, and a file # with the same name and `.gz` extension appended is found in the same directory. # Precompressed files are only served if they are newer than the original file. +# +# NOTE: To use `StaticFileHandler`, you must explicitly import it with `require "http"` class HTTP::StaticFileHandler include HTTP::Handler diff --git a/src/http/server/handlers/websocket_handler.cr b/src/http/server/handlers/websocket_handler.cr index c287e91dbb3b..c201f794e909 100644 --- a/src/http/server/handlers/websocket_handler.cr +++ b/src/http/server/handlers/websocket_handler.cr @@ -3,6 +3,8 @@ require "http/web_socket" # A handler which adds websocket functionality to an `HTTP::Server`. # +# NOTE: To use `WebSocketHandler`, you must explicitly import it with `require "http"` +# # When a request can be upgraded, the associated `HTTP::Websocket` and # `HTTP::Server::Context` will be yielded to the block. For example: # diff --git a/src/http/status.cr b/src/http/status.cr index f3920b808e82..a02299f9fed7 100644 --- a/src/http/status.cr +++ b/src/http/status.cr @@ -4,6 +4,8 @@ # # It provides constants for the defined HTTP status codes as well as helper # methods to easily identify the type of response. +# +# NOTE: To use `Status`, you must explicitly import it with `require "http/status"` enum HTTP::Status CONTINUE = 100 SWITCHING_PROTOCOLS = 101 diff --git a/src/http/web_socket.cr b/src/http/web_socket.cr index 9359c6c194bf..823e6b4e2eab 100644 --- a/src/http/web_socket.cr +++ b/src/http/web_socket.cr @@ -1,6 +1,8 @@ require "./client" require "./headers" + +# NOTE: To use `WebSocket`, you must explicitly import it with `require "http/web_socket"` class HTTP::WebSocket getter? closed = false diff --git a/src/ini.cr b/src/ini.cr index 39a82dc44894..79d7cd1bcdeb 100644 --- a/src/ini.cr +++ b/src/ini.cr @@ -1,3 +1,4 @@ +# NOTE: To use `INI`, you must explicitly import it with `require "ini"` module INI # Exception thrown on an INI parse error. class ParseException < Exception diff --git a/src/json.cr b/src/json.cr index a9eae0d8cf99..f55aca854c00 100644 --- a/src/json.cr +++ b/src/json.cr @@ -1,5 +1,7 @@ # The JSON module allows parsing and generating [JSON](http://json.org/) documents. # +# NOTE: To use `JSON` or its children, you must explicitly import it with `require "json"` +# # ### General type-safe interface # # The general type-safe interface for parsing JSON is to invoke `T.from_json` on a diff --git a/src/levenshtein.cr b/src/levenshtein.cr index 571e0ab830e6..e890d59c90ef 100644 --- a/src/levenshtein.cr +++ b/src/levenshtein.cr @@ -1,4 +1,6 @@ # Levenshtein distance methods. +# +# NOTE: To use `Levenshtein`, you must explicitly import it with `require "levenshtein"` module Levenshtein # Computes the [levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of two strings. # diff --git a/src/log.cr b/src/log.cr index 428c8e19fd11..9620a2c56992 100644 --- a/src/log.cr +++ b/src/log.cr @@ -7,6 +7,8 @@ # `#error`, and `#fatal` methods. They expect a block that will evaluate to the # message of the entry: # +# NOTE: To use `Log`, you must explicitly import it with `require "log"` +# # ``` # require "log" # diff --git a/src/mime.cr b/src/mime.cr index 4e794a803271..ac653e5c9f89 100644 --- a/src/mime.cr +++ b/src/mime.cr @@ -2,6 +2,8 @@ require "crystal/system/mime" # This module implements a global MIME registry. # +# NOTE: To use `MIME`, you must explicitly import it with `require "mime"` +# # ``` # require "mime" # diff --git a/src/oauth/oauth.cr b/src/oauth/oauth.cr index 5379ceb1f212..292055cfc777 100644 --- a/src/oauth/oauth.cr +++ b/src/oauth/oauth.cr @@ -1,6 +1,8 @@ # The OAuth module provides an `OAuth::Consumer` as specified by # [RFC 5849](https://tools.ietf.org/html/rfc5849). # +# NOTE: To use `OAuth`, you must explicitly import it with `require "oauth"` +# # ### Performing HTTP client requests with OAuth authentication # # Assuming you have an access token, its secret, the consumer key and the consumer secret, diff --git a/src/oauth2/oauth2.cr b/src/oauth2/oauth2.cr index 014e300a8f4e..3a9cde157f39 100644 --- a/src/oauth2/oauth2.cr +++ b/src/oauth2/oauth2.cr @@ -1,6 +1,8 @@ # The OAuth module provides an `OAuth2::Client` as specified # by [RFC 6749](https://tools.ietf.org/html/rfc6749). # +# NOTE: To use `OAuth2`, you must explicitly import it with `require "oauth2"` +# # ### Performing HTTP client requests with OAuth2 authentication # # Assuming you have an access token, you can setup an `HTTP::Client` diff --git a/src/openssl.cr b/src/openssl.cr index 71086e577df6..802c9a05e7d3 100644 --- a/src/openssl.cr +++ b/src/openssl.cr @@ -1,6 +1,8 @@ require "./openssl/lib_ssl" require "./openssl/error" +# NOTE: To use `OpenSSL`, you must explicitly import it with `require "openssl"` +# # ## OpenSSL Integration # # - TLS sockets need a context, potentially with keys (required for servers) and configuration. diff --git a/src/option_parser.cr b/src/option_parser.cr index 175926a8c730..5f61e73cd58d 100644 --- a/src/option_parser.cr +++ b/src/option_parser.cr @@ -7,6 +7,8 @@ # # Run `crystal` for an example of a CLI built with `OptionParser`. # +# NOTE: To use `OptionParser`, you must explicitly import it with `require "option_parser"` +# # Short example: # # ``` diff --git a/src/socket/ip_socket.cr b/src/socket/ip_socket.cr index 2f98063645b1..918b4d2b8591 100644 --- a/src/socket/ip_socket.cr +++ b/src/socket/ip_socket.cr @@ -1,3 +1,4 @@ +# NOTE: To use `IPSocket`, you must explicitly import it with `require "socket/ip_socket"` class IPSocket < Socket # Returns the `IPAddress` for the local end of the IP socket. getter local_address : Socket::IPAddress { system_local_address } diff --git a/src/socket/tcp_server.cr b/src/socket/tcp_server.cr index 51d828d45426..c5cf3e1fcef0 100644 --- a/src/socket/tcp_server.cr +++ b/src/socket/tcp_server.cr @@ -2,6 +2,8 @@ require "./tcp_socket" # A Transmission Control Protocol (TCP/IP) server. # +# NOTE: To use `TCPServer`, you must explicitly import it with `require "socket"` +# # Usage example: # ``` # require "socket" diff --git a/src/socket/tcp_socket.cr b/src/socket/tcp_socket.cr index 980f0b338cff..06e3d6f9b138 100644 --- a/src/socket/tcp_socket.cr +++ b/src/socket/tcp_socket.cr @@ -2,6 +2,8 @@ require "./ip_socket" # A Transmission Control Protocol (TCP/IP) socket. # +# NOTE: To use `TCPSocket`, you must explicitly import it with `require "socket"` +# # Usage example: # ``` # require "socket" diff --git a/src/socket/udp_socket.cr b/src/socket/udp_socket.cr index 3e9cebe0a01d..86132c54d0c7 100644 --- a/src/socket/udp_socket.cr +++ b/src/socket/udp_socket.cr @@ -15,6 +15,8 @@ require "./ip_socket" # This implementation supports both IPv4 and IPv6 addresses. For IPv4 addresses you must use # `Socket::Family::INET` family (default) or `Socket::Family::INET6` for IPv6 # addresses. # +# NOTE: To use `UDPSocket`, you must explicitly import it with `require "socket"` +# # Usage example: # # ``` diff --git a/src/socket/unix_server.cr b/src/socket/unix_server.cr index 98425e86cc54..e53f71d00842 100644 --- a/src/socket/unix_server.cr +++ b/src/socket/unix_server.cr @@ -4,6 +4,8 @@ require "./unix_socket" # # Only available on UNIX and UNIX-like operating systems. # +# NOTE: To use `UNIXServer`, you must explicitly import it with `require "socket"` +# # Example usage: # ``` # require "socket" diff --git a/src/socket/unix_socket.cr b/src/socket/unix_socket.cr index 6a4dbb3d340a..16ad99700db4 100644 --- a/src/socket/unix_socket.cr +++ b/src/socket/unix_socket.cr @@ -2,6 +2,8 @@ # # Only available on UNIX and UNIX-like operating systems. # +# NOTE: To use `UNIXSocket`, you must explicitly import it with `require "socket"` +# # Example usage: # ``` # require "socket" diff --git a/src/string_pool.cr b/src/string_pool.cr index 03b4246a3e0c..448196bcf622 100644 --- a/src/string_pool.cr +++ b/src/string_pool.cr @@ -2,6 +2,8 @@ # It allows a runtime to save memory by preserving strings in a pool, allowing to # reuse an instance of a common string instead of creating a new one. # +# NOTE: To use `StringPool`, you must explicitly import it with `require "string_pool"` +# # ``` # require "string_pool" # diff --git a/src/string_scanner.cr b/src/string_scanner.cr index b79725a9c354..c679f8de46d7 100644 --- a/src/string_scanner.cr +++ b/src/string_scanner.cr @@ -1,5 +1,7 @@ # `StringScanner` provides for lexical scanning operations on a `String`. # +# NOTE: To use `StringScanner`, you must explicitly import it with `require "string_scanner"` +# # ### Example # # ``` diff --git a/src/system/group.cr b/src/system/group.cr index 47c43ccee1ac..bd992e6af19d 100644 --- a/src/system/group.cr +++ b/src/system/group.cr @@ -2,6 +2,8 @@ require "crystal/system/group" # Represents a group of users on the host system. # +# NOTE: To use Group, you must explicitly import it with `require "system/group"` +# # Groups can be retrieved by either group name or their group ID: # # ``` diff --git a/src/system/user.cr b/src/system/user.cr index 2d0c9607056d..f23e13e6dc4c 100644 --- a/src/system/user.cr +++ b/src/system/user.cr @@ -2,6 +2,8 @@ require "crystal/system/user" # Represents a user on the host system. # +# NOTE: To use User, you must explicitly import it with `require "system/user"` +# # Users can be retrieved by either username or their user ID: # # ``` diff --git a/src/uri.cr b/src/uri.cr index 36a407e1d35b..06842deadf6d 100644 --- a/src/uri.cr +++ b/src/uri.cr @@ -9,6 +9,8 @@ require "./uri/params" # their components or by parsing their string forms and methods for accessing the various # components of an instance. # +# NOTE: To use `URI`, you must explicitly import it with `require "uri"` +# # Basic example: # # ``` diff --git a/src/uuid.cr b/src/uuid.cr index 2146c26b43bb..7c8d44478f84 100644 --- a/src/uuid.cr +++ b/src/uuid.cr @@ -1,4 +1,6 @@ # Represents a UUID (Universally Unique IDentifier). +# +# NOTE: To use `UUID`, you must explicitly import it with `require "uuid"` struct UUID include Comparable(UUID) diff --git a/src/weak_ref.cr b/src/weak_ref.cr index 103aedd30e7c..b5f7468383d0 100644 --- a/src/weak_ref.cr +++ b/src/weak_ref.cr @@ -1,6 +1,7 @@ # Weak Reference class that allows a referenced object to be garbage-collected. # # WARNING: The referenced object cannot be a module. +# NOTE: To use `WeakRef`, you must explicitly import it with `require "weak_ref"` # # ``` # require "weak_ref" diff --git a/src/xml.cr b/src/xml.cr index 9e1a19e4cc7c..1f0085fcd063 100644 --- a/src/xml.cr +++ b/src/xml.cr @@ -1,5 +1,7 @@ # The XML module allows parsing and generating [XML](https://www.w3.org/XML/) documents. # +# NOTE: To use `XML`, you must explicitly import it with `require "xml"` +# # ### Parsing # # `XML#parse` will parse xml from `String` or `IO` and return xml document as an `XML::Node` which represents all kinds of xml nodes. diff --git a/src/yaml.cr b/src/yaml.cr index 23a5843dfecb..c9ecb746ee69 100644 --- a/src/yaml.cr +++ b/src/yaml.cr @@ -10,6 +10,8 @@ require "base64" # version 1.1 to/from native Crystal data structures, with the additional # independent types specified in http://yaml.org/type/ # +# NOTE: To use `YAML`, you must explicitly import it with `require "yaml"` +# # ### Parsing with `#parse` and `#parse_all` # # `YAML.parse` will return an `Any`, which is a convenient wrapper around all possible