github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

brightbox / rujitsu

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 14
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (2)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Various Helper Methods to smooth your Ruby development day — Read more

  cancel

http://www.brightbox.co.uk/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

[RELEASE] 0.3.1 in? your grammar fix 
rahoulb (author)
Fri Dec 04 09:28:18 -0800 2009
commit  7b680500a920556d46b9fa8bc90548e365cfd228
tree    e928fbae4d27822e65bae85a48adcce631718640
parent  0e8cfdb5c7ef012c6dbcd490eb7d53e27eec09be
rujitsu /
name age
history
message
file .gitignore Loading commit data...
file CHANGELOG
file README.rdoc
file Rakefile
directory lib/
file rujitsu.gemspec
directory spec/
directory tasks/
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..."

Testing for inclusion within a container

As Rubyists we are all familiar with using include? to test if our variable is one of a number of values.

  if ['hello', 'world'].include?(@my_value) ...

However, it doesn’t read correctly. Rujitsu allows you to write the following as it reads much more like English.

  if @my_value.in? ['hello', 'world'] ...

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.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server