8000 Merge pull request #446 from BurdetteLamar/rdoc · ruby/json@c5083b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5083b2

Browse files
authored
Merge pull request #446 from BurdetteLamar/rdoc
Partial compliance with doc/method_documentation.rdoc
2 parents 09b0bcb + 6dfa885 commit c5083b2

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/json/common.rb

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ class << self
77
# :call-seq:
88
# JSON[object] -> new_array or new_string
99
#
10-
# If +object+ is a
11-
# {String-convertible object}[doc/implicit_conversion_rdoc.html#label-String-Convertible+Objects],
10+
# If +object+ is a \String,
1211
# calls JSON.parse with +object+ and +opts+ (see method #parse):
1312
# json = '[0, 1, null]'
1413
# JSON[json]# => [0, 1, nil]
@@ -149,12 +148,9 @@ class MissingUnicodeSupport < JSONError; end
149148
#
150149
# Returns the Ruby objects created by parsing the given +source+.
151150
#
152-
# Argument +source+ contains the \String to be parsed. It must be a
153-
# {String-convertible object}[doc/implicit_conversion_rdoc.html#label-String-Convertible+Objects]
154-
# (implementing +to_str+), and must contain valid \JSON data.
151+
# Argument +source+ contains the \String to be parsed.
155152
#
156-
# Argument +opts+, if given, contains options for the parsing, and must be a
157-
# {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash+Convertible+Objects].
153+
# Argument +opts+, if given, contains a \Hash of options for the parsing.
158154
# See {Parsing Options}[#module-JSON-label-Parsing+Options].
159155
#
160156
# ---
@@ -249,22 +245,17 @@ def load_file!(filespec, opts = {})
249245
#
250246
# Argument +obj+ is the Ruby object to be converted to \JSON.
251247
#
252-
# Argument +opts+, if given, contains options for the generation, and must be a
253-
# {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash-Convertible+Objects].
248+
# Argument +opts+, if given, contains a \Hash of options for the generation.
254249
# See {Generating Options}[#module-JSON-label-Generating+Options].
255250
#
256251
# ---
257252
#
258-
# When +obj+ is an
259-
# {Array-convertible object}[doc/implicit_conversion_rdoc.html#label-Array-Convertible+Objects]
260-
# (implementing +to_ary+), returns a \String containing a \JSON array:
253+
# When +obj+ is an \Array, returns a \String containing a \JSON array:
261254
# obj = ["foo", 1.0, true, false, nil]
262255
# json = JSON.generate(obj)
263256
# json # => '["foo",1.0,true,false,null]'
264257
#
265-
# When +obj+ is a
266-
# {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash-Convertible+Objects],
267-
# return a \String containing a \JSON object:
258+
# When +obj+ is a \Hash, returns a \String containing a \JSON object:
268259
# obj = {foo: 0, bar: 's', baz: :bat}
269260
# json = JSON.generate(obj)
270261
# json # => '{"foo":0,"bar":"s","baz":"bat"}'
@@ -436,8 +427,7 @@ class << self
436427
# BEWARE: This method is meant to serialise data from trusted user input,
437428
# like from your own database server or clients under your control, it could
438429
# be dangerous to allow untrusted users to pass JSON sources into it.
439-
# - Argument +opts+, if given, contains options for the parsing, and must be a
440-
# {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash+Convertible+Objects].
430+
# - Argument +opts+, if given, contains a \Hash of options for the parsing.
441431
# See {Parsing Options}[#module-JSON-label-Parsing+Options].
442432
# The default options can be changed via method JSON.load_default_options=.
443433
#

0 commit comments

Comments
 (0)
0