# PointRb [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/maxmeyer/prointrb) [![Build Status](https://travis-ci.org/maxmeyer/pointrb.png?branch=master)](https://travis-ci.org/maxmeyer/pointrb) ## Installation Add this line to your application's Gemfile: gem 'pointrb' And then execute: $ bundle Or install it yourself as: $ gem install pointrb ## Usage Currently the following strategies are supported
Strategy Description
:contains_all True if all of the given keywords are part of the data
:contains_any True if any of the given keywords are part of the data
:not_contains True if the given keywords are not part of the data
:contains_all_as_substring True if all given keywords are a substring of an data element
:contains_any_as_substring True if any given keyword are a substring of an data element
:not_contains_substring True if none of the given keywords is a substring of an data element
:is_equal True if both, the keywords and the data, are identical
:is_not_equal True if the keywords are didfferent from the data
### Simple example ```ruby require 'the_array_comparator' comparator = TheArrayComparator::Comparator.new data = %w{ a b c d } keyword_overlap = %w{ a b } comparator.add_check data , :contains_all , keyword_overlap result = comparator.success? puts result #should be true ``` ### Example with substrings ```ruby require 'the_array_comparator' comparator = TheArrayComparator::Comparator.new data = %w{ acd b } keyword_overlap = %w{ cd b } comparator.add_check data , :contains_all_as_substring, keyword_overlap result = comparator.success? puts result #should be true ``` ### Example with exceptions ```ruby require 'the_array_comparator' comparator = TheArrayComparator::Comparator.new data = %w{ acd b } keyword_overlap = %w{ a b } exceptions = %w{ cd } comparator.add_check data , :contains_all_as_substring, keyword_overlap, exceptions result = comparator.success? puts result #should be false ``` ### Extend the library If you wish to write your own comparators you can do so. Just register those classes with a keyword. ```ruby TheArrayComparator::Comparator.register :my_contains, Strategies::MyContains ``` ## Further reading Please the the full api-documentation on [rdoc info](http://rdoc.info/github/maxmeyer/the_array_comparator/frames) for further reading. I just give you a brief overview of all the available methods. There's also a brief [guide](API-GUIDE.md) about howto discover the API. ## Contributing Please see [CONTRIBUTIONS.md](CONTRIBUTIONS.md). ## Copyright (c) 2013 Max Meyer. All rights reserved. Please also see [LICENSE.md](LICENSE.md).