Class: RBHive::ResultSet
- Inherits:
-
Array
- Object
- Array
- RBHive::ResultSet
- Defined in:
- lib/rbhive/result_set.rb
Instance Method Summary collapse
- #as_arrays ⇒ Object
- #column_names ⇒ Object
- #column_type_map ⇒ Object
-
#initialize(rows, schema) ⇒ ResultSet
constructor
A new instance of ResultSet.
- #to_csv(out_file = nil) ⇒ Object
- #to_tsv(out_file = nil) ⇒ Object
Constructor Details
#initialize(rows, schema) ⇒ ResultSet
Returns a new instance of ResultSet.
3 4 5 6 |
# File 'lib/rbhive/result_set.rb', line 3 def initialize(rows, schema) @schema = schema super(rows.map {|r| @schema.coerce_row(r) }) end |
Instance Method Details
#as_arrays ⇒ Object
24 25 26 |
# File 'lib/rbhive/result_set.rb', line 24 def as_arrays @as_arrays ||= self.map{ |r| @schema.coerce_row_to_array(r) } end |
#column_names ⇒ Object
8 9 10 |
# File 'lib/rbhive/result_set.rb', line 8 def column_names @schema.column_names end |
#column_type_map ⇒ Object
12 13 14 |
# File 'lib/rbhive/result_set.rb', line 12 def column_type_map @schema.column_type_map end |
#to_csv(out_file = nil) ⇒ Object
16 17 18 |
# File 'lib/rbhive/result_set.rb', line 16 def to_csv(out_file=nil) to_seperated_output(",", out_file) end |
#to_tsv(out_file = nil) ⇒ Object
20 21 22 |
# File 'lib/rbhive/result_set.rb', line 20 def to_tsv(out_file=nil) to_seperated_output("\t", out_file) end |