Sha256: 9e64b298b50b37abc13a54468992656cabb3f293ced72ec7e344f9994251b763

Contents?: true

Size: 398 Bytes

Versions: 2

Compression:

Stored size: 398 Bytes

Contents

class RemoteTable
  module Json
    def _each
      require 'json'
     
      data.each do |row|
        yield row
      end
    ensure
      local_copy.cleanup
    end

    private

    def json_string
      local_copy.encoded_io.read
    end

    def parsed_json
      ::JSON.parse(json_string)
    end

    def data
      root_node.nil? ? parsed_json : parsed_json[root_node]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
remote_table-3.3.3 lib/remote_table/json.rb
remote_table-3.3.2 lib/remote_table/json.rb