Method: RTree.json_read

Defined in:
lib/rtree.rb

.json_read(io_arg) ⇒ RTree

Create a new RTree instance from JSON path or stream

Examples:

Using a path

rtree = RTree.json_read('rtree.json')

Using a stream

rtree = File.open('rtree.json', 'r') { |io| RTree.json_read(io) }

Parameters:

  • io_arg (String|IO)

    a path or readable stream

Returns:

  • (RTree)

    the newly instantiated RTree

See Also:



165
166
167
168
169
# File 'lib/rtree.rb', line 165

def json_read(io_arg)
  RTree::IOUtil.io_with_mode(io_arg, 'r') do |io|
    super(io)
  end
end