
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
The library to verify variables are satisfy given condititions and raise ArgumentError
otherwise.
Defines a #verify
instance method with a block to be yielded in a variable's scope and raised an error if the block returns false or fails.
Add this line to your application's Gemfile:
gem "verifier"
And then execute:
$ bundle
Or install it yourself as:
$ gem install verifier
Include the module into class or Method to use it in the instance methods, or extend the class to check verifier of the class methods.
require "verifier"
class Greeter
include Verifier
end
This will define the #verify
instance method.
Call it from your method with the names of the verified variable and the condition, and the block to be called in the scope of a value, returned by the method.
class Greeter
# ...
def hello(name)
verify(:name, :long_enough) { count > 1 }
"Hello, #{ name }!"
end
end
Then define i18n translations for error messages:
# config/locales/en.yml
---
en:
verifier: # the module's scope
greeter: # the class name
instance: # the scope for the method
# the message to be raised when the method raises an exception
fails: "The method fails: %{value}"
# the message to be raised when the method isn't defined
undefined: "The method undefined: %{value}"
name: # the name of the method to be verified
# the message to be raised when the block fails or returns false
long_enough: "The name to greet seems damn short: %{value}"
The block is yielded in the scope of a corresponding variable.
An ArgumentError
will be raised in any case when:
true
(see the motivation [below]{#negation}).greeter = Greeter.new
greeter.hello "Al"
# => "Hello, Al!"
greeter.hello "A"
# => <ArgumentError @message="The name to greet seems damn short: A" ...>
Tested under MRI rubies >= 2.1
RSpec 3.0+ used for testing
Collection of used testing, debugging and code metric tools is defined in the hexx-suit gem.
See MIT LICENSE.
FAQs
Unknown package
We found that verifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.