We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f1bba3 commit dbcf614Copy full SHA for dbcf614
lib/json/common.rb
@@ -167,6 +167,13 @@ def detailed_message(...)
167
# system. Usually this means that the iconv library is not installed.
168
class MissingUnicodeSupport < JSONError; end
169
170
+ # Fragment of JSON document that is to be included as is:
171
+ # fragment = JSON::Fragment.new("[1, 2, 3]")
172
+ # JSON.generate({ count: 3, items: fragments })
173
+ #
174
+ # This allows to easily assemble multiple JSON fragments that have
175
+ # been peristed somewhere without having to parse them nor resorting
176
+ # to string interpolation.
177
Fragment = Struct.new(:json) do
178
def to_json(state = nil, *)
179
json
0 commit comments