Class: Sqlite::Dataset
- Inherits:
-
Object
- Object
- Sqlite::Dataset
- Defined in:
- lib/dataset.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
- #compare(other) ⇒ Object
-
#initialize(data) ⇒ Dataset
constructor
A new instance of Dataset.
Constructor Details
#initialize(data) ⇒ Dataset
Returns a new instance of Dataset.
5 6 7 8 9 10 11 12 |
# File 'lib/dataset.rb', line 5 def initialize(data) @header = @rows = [] rows = split_lines data unless rows.empty? @header = split_pipe rows.shift @rows = rows.map { |item| split_pipe item } end end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
3 4 5 |
# File 'lib/dataset.rb', line 3 def header @header end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
3 4 5 |
# File 'lib/dataset.rb', line 3 def rows @rows end |
Instance Method Details
#compare(other) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dataset.rb', line 14 def compare(other) same_header = same_header other.header same_rows = same_rows other.rows if same_header & same_rows :equals elsif !same_header :distinct_columns else :distinct_rows end end |