Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / json / encoders / enumerable.rb
1 module Enumerable
2 # Returns a JSON string representing the enumerable. Any +options+
3 # given will be passed on to its elements. For example:
4 #
5 # users = User.find(:all)
6 # # => users.to_json(:only => :name)
7 #
8 # will pass the <tt>:only => :name</tt> option to each user.
9 def to_json(options = {}) #:nodoc:
10 "[#{map { |value| ActiveSupport::JSON.encode(value, options) } * ', '}]"
11 end
12 end