New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hashy_validator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashy_validator

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

HashyValidator

HashyValidator is a custom Ruby on Rails validator designed to validate an array of hashes based on HashValidator criteria but also the following new criteria:

  • unique: A value within each hash that has to be unique across the whole array

Installation

Add this line to your application's Gemfile:

gem 'hashy_validator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install hashy_validator

Usage

To leverage HashyValidator in your Rails model, follow these steps:

  1. Add the gem to your Gemfile and run bundle install as mentioned above.

  2. In your model, use the validate method to apply the hashy_array validation.

    class YourModel < ApplicationRecord
      validates :pricing, hashy_array: {
        minutes: HashValidator.multiple('integer', 'unique'),
        price_cents: HashValidator.multiple('integer')
      }
    end
    

    Customize each entry validators according to HashValidator criteria

Testing

rake test

Contributing

Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration. To ease up contribution we provide a VSCode devcontainer to run the project in a container. Before submitting a PR do not forget to run all tests by doing rake test or against a single file ruby -I. test/validation_sqlite_test.rb.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 29 Jan 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc