# frozen_string_literal: true #-- # gravaty # rubocop:disable Style/AsciiComments # © 2013 Marco Bresciani # rubocop:enable Style/AsciiComments # # This file is part of gravaty. # # gravaty is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # gravaty is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with gravaty. If not, see . # # SPDX-FileCopyrightText: 2013 Marco Bresciani # # SPDX-License-Identifier: GPL-3.0-or-later #++ require_relative '../lib/gravaty' i = 0 # Raises ArgumentError when email address is nil puts '==========================================' puts "BASICS '#{i}': Raises ArgumentError when email address is nil." puts 'irb(main):001:0> Gravaty::gravatize nil' begin Gravaty.gravatize(nil) rescue ArgumentError => e puts e.message end puts '------------------------------------------' puts i += 1 # Creates the Gravaty object with an (example) email puts '==========================================' puts "BASICS '#{i}': Creates the Gravaty object with an (example) email." puts "irb(main):001:0> a_gravaty = Gravaty::gravatize 'user@example.com'" a_gravaty = Gravaty.gravatize 'user@example.com' puts '------------------------------------------' puts i += 1 # Prints the email # (user@example.com) puts '==========================================' puts "BASICS '#{i}': Prints the email (user@example.com)." puts 'irb(main):001:0> puts a_gravaty.email' puts a_gravaty.email puts '------------------------------------------' puts i += 1 # Prints the MD5 digest of the downcased email address # (b58996c504c5638798eb6b511e6f49af) puts '==========================================' puts "BASICS '#{i}': Prints the MD5 digest of the downcased email address (b58996c504c5638798eb6b511e6f49af)." puts 'irb(main):001:0> puts a_gravaty.digest' puts a_gravaty.digest puts '------------------------------------------' puts i += 1 # Prints the current gravaty according to previously done ! operations. # Email address if no operation has been done (user@example.com) # (b58996c504c5638798eb6b511e6f49af) puts '==========================================' # rubocop:disable Layout/LineLength puts "BASICS '#{i}': Prints the current gravaty according to previously done ! operations. Email address if no operation has been done (user@example.com)." # rubocop:enable Layout/LineLength puts 'irb(main):001:0> puts a_gravaty' puts a_gravaty puts '------------------------------------------' puts