public
Description: Various Helper Methods to smooth your Ruby development day
Homepage: http://www.brightbox.co.uk/
Clone URL: git://github.com/brightbox/rujitsu.git
caius (author)
Wed Apr 08 09:42:49 -0700 2009
commit  8bd99da2c1fe223737902347728851e26a083895
tree    15337f87a42ece3ab3796716f1a2b5b8d150e42d
parent  d5cd98726973002efdb3ba5e621023fe8d487f45
name age message
file .gitignore Mon Nov 24 03:33:24 -0800 2008 added CHANGELOG [rahoulb]
file CHANGELOG Wed Apr 08 09:42:49 -0700 2009 Bumping to 0.2.5 [caius]
file README.rdoc Fri Feb 20 07:18:29 -0800 2009 Bumping to 0.1.9 [caius]
file Rakefile Wed Apr 08 09:42:49 -0700 2009 Bumping to 0.2.5 [caius]
directory lib/ Wed Apr 08 09:40:58 -0700 2009 Adding a way to require everything in rujitsu. ... [caius]
file rujitsu.gemspec Wed Apr 08 09:42:49 -0700 2009 Bumping to 0.2.5 [caius]
directory spec/ Mon Apr 06 10:44:48 -0700 2009 Adding :exclude to Fixnum#random_(?!numbers). S... [caius]
directory tasks/ Mon Nov 24 05:52:27 -0800 2008 Adding `rake spec` to run all specs [caius]
README.rdoc

rujitsu

A ruby gem with various helper methods to smooth out your Ruby development.

Install

  gem install brightbox-rujitsu --source http://gems.github.com

Including

  require "rujitsu"
  require "rujitsu/grammar"

Rails

To require in rails 2.2, add the following to your environment.rb file.

  config.gem "brightbox-rujitsu", :lib => "rujitsu", :source => "http://gems.github.com"
  config.gem "brightbox-rujitsu", :lib => "rujitsu/grammar", :source => "http://gems.github.com"

Documentation

Run rake docs and open doc/index.html.

Usage

Generating random strings

The Fixnum class has a couple of extensions allowing you to generate random strings.

  5.random_letters
  5.random_numbers
  5.random_characters

You can also generate a variable length string.

  (3..5).random_letters

This generates a string of random letters whose length is 3, 4 or 5 characters.

URL-friendly strings

The String class has an extension that strips out URL-unfriendly characters.

  ""$%hello!@ 123 there'".to_url # => "hello-123-there"

Truncating strings

The String class has an extension that truncates it to a customisable length with a customisable suffix.

  "this is a string".truncate(:length => 15) # => "this is a st..."

Grammar

So far the grammar library just adds the method should_recieve for rspec assertions. Use it to find out what it does!

Released under the MIT Licence

Copyright © 2008 Brightbox Systems Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

See www.brightbox.co.uk/ for contact details.