Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YARD docs for Faker::Crypto. #1851

Merged
merged 1 commit into from Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/faker/default/crypto.rb
Expand Up @@ -5,14 +5,41 @@
module Faker
class Crypto < Base
class << self
##
# Produces an MD5 hash.
#
# @return [String]
#
# @example
# Faker::Crypto.md5 #=> "6b5ed240042e8a65c55ddb826c3408e6"
#
# @faker.version 1.6.4
def md5
Digest::MD5.hexdigest(Lorem.characters)
end

##
# Produces a SHA1 hash.
#
# @return [String]
#
# @example
# Faker::Crypto.sha1 #=> "4e99e31c51eef8b2d290e709f757f92e558a503f"
#
# @faker.version 1.6.4
def sha1
Digest::SHA1.hexdigest(Lorem.characters)
end

##
# Produces a SHA256 hash.
#
# @return [String]
#
# @example
# Faker::Crypto.sha256 #=> "51e4dbb424cd9db1ec5fb989514f2a35652ececef33f21c8dd1fd61bb8e3929d"
#
# @faker.version 1.6.4
def sha256
Digest::SHA256.hexdigest(Lorem.characters)
end
Expand Down