Class: DataObjects::Salesforce::Reader
- Inherits:
-
Object
- Object
- DataObjects::Salesforce::Reader
- Defined in:
- lib/do_salesforce/reader.rb
Instance Method Summary collapse
-
#close ⇒ Object
Close the reader discarding any unread results.
-
#each ⇒ Object
Yield each row to the given block as a Hash.
-
#field_count ⇒ Object
Return the number of fields in the result set.
-
#fields ⇒ Object
Return the array of field names.
-
#initialize ⇒ Reader
constructor
A new instance of Reader.
-
#next! ⇒ Object
Discard the current row (if any) and read the next one (returning true), or return nil if there is no further row.
-
#values ⇒ Object
Return the array of field values for the current row.
Constructor Details
#initialize ⇒ Reader
Returns a new instance of Reader.
5 6 |
# File 'lib/do_salesforce/reader.rb', line 5 def initialize end |
Instance Method Details
#close ⇒ Object
Close the reader discarding any unread results.
19 20 21 |
# File 'lib/do_salesforce/reader.rb', line 19 def close raise NotImplementedError.new end |
#each ⇒ Object
Yield each row to the given block as a Hash
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/do_salesforce/reader.rb', line 34 def each begin while next! row = {} fields.each_with_index { |field, index| row[field] = values[index] } yield row end ensure close end self end |
#field_count ⇒ Object
Return the number of fields in the result set.
29 30 31 |
# File 'lib/do_salesforce/reader.rb', line 29 def field_count raise NotImplementedError.new end |
#fields ⇒ Object
Return the array of field names
9 10 11 |
# File 'lib/do_salesforce/reader.rb', line 9 def fields raise NotImplementedError.new end |
#next! ⇒ Object
Discard the current row (if any) and read the next one (returning true), or return nil if there is no further row.
24 25 26 |
# File 'lib/do_salesforce/reader.rb', line 24 def next! raise NotImplementedError.new end |
#values ⇒ Object
Return the array of field values for the current row. Not legal after next! has returned false or before it’s been called
14 15 16 |
# File 'lib/do_salesforce/reader.rb', line 14 def values raise NotImplementedError.new end |