No commit activity in last 3 years
No release in over 3 years
Library to validate: date, date_time, ip address, mac address.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 3.2.0
 Project Readme

UniversalValidators Build Status

Library to validate:

  • date
  • date_time
  • ip address
  • mac address

Installation

Add this line to your application's Gemfile:

gem 'universal_validators'

And then execute:

$ bundle

Or install it yourself as:

$ gem install universal_validators

Usage

Date validation:

date = UniversalValidators::DateValidator.new('2015-02-25')
date.valid?
=> true

DateTime validation:

date_time = UniversalValidators::DateTimeValidator.new('2015-02-25 12:33')
date_time.valid?
=> true

Ip address validation (without netmask):

ip = UniversalValidators::IpValidator.new('127.0.0.1')
ip.valid?
=> true

Ip address validation (with netmask):

ip = UniversalValidators::IpValidator.new('127.0.0.1/32', true)
ip.valid?
=> true

Mac address validation:

mac = UniversalValidators::MacAddressValidator.new('00:0A:CD:00:CC:FE')
mac.valid?
=> true

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request