Sha256: 953e6f83d9099aa561f5c76e281c708f8f33716ea3639f8028c7a6bfab15f38c
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
= Backports Library Essential backports that make it possible to use some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.x Conditions for inclusion: 1. Standard in either rails or ruby 2. Won't break older code 3. Simple and self-contained The first and second rules avoids conflicts in future and the past respectively. Because of the second rule, incompatibilities between 1.8 and 1.9 methods are left alone. For example, <tt>Module::instance_methods</tt> returns strings in 1.8 and symbols in 1.9; no change can be made without the risk of breaking existing code. More complex features of activesupport (even things like <tt>String::pluralize</tt>), won't be included. <tt>require 'activesupport'</tt> if you need them! I've added those as I need them; pull requests welcome (with tests for ruby 1.9 backports) == Compatibility Works with ruby 1.8 & 1.9 = List of backports * Symbol * +to_proc+ (e.g. <tt>foo.map(&:bar)</tt> ) * Kernel * +require_relative+ * Module * +alias_method_chain+ * Object * +tap+, +returning+ * +try+ * String * <tt>start_with?</tt>, <tt>end_with?</tt> * +camelize+, +underscore+ * +dasherize+, +demodulize+ * +constantize+ * Hash * <tt>Hash[[[:foo, :bar],[:hello, "world"]]] ==> {:foo => :bar, :hello => "world"}</tt> * +key+ * +symbolize_keys+, <tt>symbolize_keys!</tt> * +reverse_merge+, <tt>reverse_merge!</tt> * Enumerable * +sum+ * +find_index+ * +take+, +take_while+, +drop+, +drop_while+ * +first+ * Array * +flatten+, <tt>flatten!</tt> * +find_index+, +find+ * Fixnum * <tt>odd?</tt>, <tt>even?</tt> Finally, there is no need to <tt>require 'enumerator'</tt> in older ruby, and +Enumerator+ can be accessed directly (instead of <tt>Enumerable::Enumerator</p>) = License +backports+ is released under the terms of the MIT License, see the included LICENSE file. The code for backports was copied from rails when available. Author:: Marc-André Lafortune
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
marcandre-backports-1.1.1 | README.rdoc |
backports-1.1.1 | README.rdoc |