756e6d2ad8
* This will significantly decrease the size of the msf install (~5 MB) * ActiveRecord & ActiveSupport are still used, and have been moved to lib/ git-svn-id: file:///home/svn/framework3/trunk@10682 4d416f70-5f16-0410-b530-b9f4589650da
18 lines
412 B
Ruby
18 lines
412 B
Ruby
module Enumerable
|
|
# Coerces the enumerable to an array for JSON encoding.
|
|
def as_json(options = nil) #:nodoc:
|
|
to_a
|
|
end
|
|
end
|
|
|
|
class Array
|
|
# Returns a JSON string representing the Array. +options+ are passed to each element.
|
|
def to_json(options = nil) #:nodoc:
|
|
"[#{map { |value| ActiveSupport::JSON.encode(value, options) } * ','}]"
|
|
end
|
|
|
|
def as_json(options = nil) #:nodoc:
|
|
self
|
|
end
|
|
end
|