Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / json / encoders / enumerable.rb
diff --git a/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb b/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb
new file mode 100644 (file)
index 0000000..881b1d6
--- /dev/null
@@ -0,0 +1,12 @@
+module Enumerable
+  # Returns a JSON string representing the enumerable. Any +options+
+  # given will be passed on to its elements. For example:
+  #
+  #   users = User.find(:all)
+  #   # => users.to_json(:only => :name)
+  #
+  # will pass the <tt>:only => :name</tt> option to each user.
+  def to_json(options = {}) #:nodoc:
+    "[#{map { |value| ActiveSupport::JSON.encode(value, options) } * ', '}]"
+  end
+end