Low commit activity in last 3 years
A long-lived project that still receives updates
Ruby base class extensions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

DmRubyExtensions

Gem Version Build Status

Adds some simple convenience methods to some Ruby classes, for use in the digitalMoksha gems. Although some of these can be found in other libraries, this includes a small handful and removes the dependency on another large library.

Installation

Add this line to your application's Gemfile:

gem 'dm_ruby_extensions'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dm_ruby_extensions

Usage

Array

  • extract_options!
  • closest_max
  • xss_aware_join
  • css_join

Date

  • to_age
  • localize

DateTime

  • to_age
  • localize

Fixnum

  • factorial
  • as_boolean

Hash

  • convert_date
  • convert_datetime
  • url_query_string
  • rekey
  • rekey!

Nil

  • to_s_default
  • as_boolean
  • to_age
  • sql_wildcard

Numeric

  • percent_of

String

  • to_s_default
  • as_boolean
  • as_css_size
  • sql_wildcard
  • replace_non_alphanumeric
  • expand_url
  • absolute_url?
  • smart_titlecase
  • smart_capitalize
  • smart_capitalize!
  • smart_truncate
  • name_case
  • name_case!

Time

  • localize

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request