Sha256: 5a5c43ea0f809907c85519be0c41b28952ea6b5606a82a31ec253071a4587aaf
Contents?: true
Size: 1.94 KB
Versions: 1
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+, +index+ * 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backports-1.1.0 | README.rdoc |