Git Product home page Git Product logo

vldmail-rb's Introduction

VldMail

VldMail is a ruby wrapper for the C language libvldmail email validation library. I built it to explore the ruby C API,to get my hands dirty building a ruby C gem, and to document how to do this for other ruby developers who might be curious about building C extensions.

N.B.: This is UNTESTED, ALPHA QUALITY CODE. Sorry for shouting. But if you landed here, because you want to use libvldmail in your ruby app, the author of libvldmail suggests using SWIG. Do that.

Recommendations for Learning About Mixing Ruby and C

tl;dr Know ruby. Learn C. Read over some of the listed resources. Read the commits in this repo from initial commit to HEAD.

Prerequisites: You should know ruby well. Basic familiarity with C is sufficient to get started. If you have no prior exposure to C, just start with K&R, 2nd ed. It's one of those rare programming books that's both useful and a good read.

Here are some resources I found helpful:

Start at ruby-lang.org and read for a high-level understanding. Then try the blog posts. Then go back to ruby-lang.org to answer your questions. Awesome C is where I found libvldmail. Maybe you'll find something there to play with.

Then there's this project: I wrote each commit to document the process of making the gem -- sort of a really slow motion live-coding presentation. (And like any live-coding, this one includes a few missteps....) So head over to Commits and work from the bottom up.

Yeah, this could probably be a blog post, but I haven't finished rewriting my blog engine yet. ;-)

Installation

Add this line to your application's Gemfile:

gem 'vldmail-rb', git: 'https://github.com/jlcapps/vldmail-rb.git', branch: 'master'

And then execute:

$ bundle install

Or follow instructions beneath Development.

Usage

require 'vldmail'

validation = VldMail::Validation.new('[email protected]')
validation.email
  => '[email protected]'
validation.success?
  => true
validation.message
  => ''
validation = VldMail::Validation.new('foo@example@com')
validation.success?
  => false
validation.message
  => 'One @ is more than enough.'

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.

License

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

vldmail-rb's People

Contributors

jlcapps avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.