You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

skills_cards_validations

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skills_cards_validations

1.5.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Skills Cards Validations

Defines the skills cards data model and methods to validate whether given data matches this model.

This gem allows different projects to have a shared way of determining whether data is a skills card and whether it is valid.

Installation

Add this line to your application's Gemfile:

gem 'skills_cards_validations'

And then execute:

$ bundle

Or install it yourself as:

$ gem install skills_cards_validations

Usage

Be sure to completely exit and re-open your running rails app or console.

Card and Data validation using the provided Validator class:

v = SkillsCardsValidations::Validator.new
v.id? 1234
# => #<Valid:0x0123>
v.id?(1234).result
# => true
v.id?(1234).original
# => 1

v.id? 123456
# => #<Invalid:0x0124>
v.id?(123456).result
# => false
v.id?(12345).original
# => 123456

You can also create your own class and use the provided mixins.

class MyCardValidator
  include SkillsCardsValidations::CardValidations

  def initialize(record)
    @record = record
  end

  def id?
    super(@record[:my_id])
  end
end

v = MyCardValidator.new({
  my_id: 1234
})

v.id?
# => #<Valid:0x0123>
v.id?.result
# => true
v.id?.original
# => 1

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags.

Contributing

Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/utahyouthvillage/skillscardsvalidations.

License

TBD

FAQs

Package last updated on 29 Apr 2019

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