Sha256: 9d834b02947f8217b763c1d9d625e355034c913c0ac6d3d5953f8deb5dec355f

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module DataObjects
  module Salesforce
    class Reader

      def initialize
      end

      # Return the array of field names
      def fields
        raise NotImplementedError.new
      end

      # Return the array of field values for the current row. Not legal after next! has returned false or before it's been called
      def values
        raise NotImplementedError.new
      end

      # Close the reader discarding any unread results.
      def close
        raise NotImplementedError.new
      end

      # Discard the current row (if any) and read the next one (returning true), or return nil if there is no further row.
      def next!
        raise NotImplementedError.new
      end

      # Return the number of fields in the result set.
      def field_count
        raise NotImplementedError.new
      end

      # Yield each row to the given block as a Hash
      def each
        begin
          while next!
            row = {}
            fields.each_with_index { |field, index| row[field] = values[index] }
            yield row
          end
        ensure
          close
        end
        self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
martinemde-dm-salesforce-adapter-1.1.0 lib/do_salesforce/reader.rb