Sha256: 4000e88391d3f43fa25932faa1ec163695d42610963dcc911ea7fa860aa6de6e
Contents?: true
Size: 717 Bytes
Versions: 1
Compression:
Stored size: 717 Bytes
Contents
#!/usr/bin/env ruby if $0 == __FILE__ $: << '.' $: << '..' $: << '../lib' $: << '../ext' end require 'oj' def sample_json(size=3) colors = [ :black, :gray, :white, :red, :blue, :yellow, :green, :purple, :orange ] container = [] size.times do |i| box = { 'color' => colors[i % colors.size], 'fragile' => (0 == (i % 2)), 'width' => i, 'height' => i, 'depth' => i, 'weight' => i * 1.3, 'address' => { 'street' => "#{i} Main Street", 'city' => 'Sity', 'state' => nil } } container << box end container end if $0 == __FILE__ File.open('sample.json', "w") { |f| f.write(Oj.dump(sample_json(3), :indent => 2)) } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oj-3.14.3 | test/sample_json.rb |