Rext

Rext is primarily used for the Evolution CMS project, and its dependencies, however it is de-coupled and free to use within your own project.

Motivations

  • ActiveSupport does not contain everything we need, and is messy IMO

  • Very easy to cherry-pick what you need

  • Provide better documentation

  • Attention to quality and performance

  • Abstraction of loosely coupled helpers used throughout Evolution and its sub-gems

Usage

require 'rext/all'

# or 

require 'rext/string'
require 'rext/hash'
...

# or 

require 'rext/string/escape'
require 'rext/enumerable/every'
...

Extensions

Below are the methods currently provided by Rext.

  • Object

    • metaclass

    • meta_def

    • meta_eval

    • indifferent_hash

    • returning

    • try

  • String

    • url_encode

    • url_decode

    • base64_encode

    • base64_decode

    • html_escape

    • merge_word / add_class

    • remove

    • digitize

    • camelize

    • constantize

    • wrap

    • starts_with?

    • ends_with?

    • plural?

    • singular?

    • first

    • last

    • from

    • switchify

    • word_frequency

    • frequency_of_word

    • to_md5

    • to_sha512

  • Integer

    • ordanalize

  • Numeric

    • bytes, kilobytes, etc

    • seconds, minutes, hours, days, …

    • to_seconds, to_minutes, to_hours, …

    • ago / before

    • since / from_now

    • format_currency

  • Hash

    • delete_at / extract!

    • switchify

    • to_query

    • apply_to / apply_to!

  • Time

    • in_words_since / in_words_since_now

    • to_time

  • Date

    • to_time

  • Module

    • chainable

    • extendable

    • call_method

  • Proc

    • yield_or_eval

  • Array

    • chunk / in_groups_of

    • pad

    • sum

    • avg / average

    • to

    • from

  • Enumerable

    • group_by

    • includes_all?

    • every

    • take

    • drop

  • Symbol

    • to_proc

  • Process

    • alive?

    • pid_from_file

Contrib

Feel free to fork Rext on github, or submit a ticket: github.com/visionmedia/rext/issues

License

(The MIT License)

Copyright © 2009 TJ Holowaychuk <[email protected]>

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, an d/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. ALINGS IN THE SOFTWARE.