Class: RubySnowflake::Result
- Inherits:
-
Object
- Object
- RubySnowflake::Result
- Includes:
- Enumerable
- Defined in:
- lib/ruby_snowflake/result.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[]=(index, value) ⇒ Object
- #columns ⇒ Object
- #each ⇒ Object
- #first ⇒ Object
- #get_all_rows ⇒ Object
-
#initialize(partition_count, row_type_data) ⇒ Result
constructor
A new instance of Result.
- #last ⇒ Object
- #size ⇒ Object (also: #length)
Constructor Details
#initialize(partition_count, row_type_data) ⇒ Result
Returns a new instance of Result.
13 14 15 16 |
# File 'lib/ruby_snowflake/result.rb', line 13 def initialize(partition_count, row_type_data) @data = Concurrent::Array.new(partition_count) (row_type_data) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/ruby_snowflake/result.rb', line 11 def data @data end |
Instance Method Details
#[]=(index, value) ⇒ Object
18 19 20 |
# File 'lib/ruby_snowflake/result.rb', line 18 def []=(index, value) data[index] = value end |
#columns ⇒ Object
50 51 52 |
# File 'lib/ruby_snowflake/result.rb', line 50 def columns @row_types.map {|type| type[:name].downcase } end |
#each ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/ruby_snowflake/result.rb', line 26 def each return to_enum(:each) unless block_given? data.each do |partition| partition.each do |row| yield wrap_row(row) end end end |
#first ⇒ Object
42 43 44 |
# File 'lib/ruby_snowflake/result.rb', line 42 def first wrap_row(data.first.first) end |
#get_all_rows ⇒ Object
22 23 24 |
# File 'lib/ruby_snowflake/result.rb', line 22 def get_all_rows map(&:to_h) end |
#last ⇒ Object
46 47 48 |
# File 'lib/ruby_snowflake/result.rb', line 46 def last wrap_row(data.last.last) end |
#size ⇒ Object Also known as: length
36 37 38 |
# File 'lib/ruby_snowflake/result.rb', line 36 def size data.map(&:size).sum end |