Class: CompletionKit::Dataset
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- CompletionKit::Dataset
- Defined in:
- app/models/completion_kit/dataset.rb
Instance Method Summary collapse
Instance Method Details
#as_json(options = {}) ⇒ Object
8 9 10 11 12 13 |
# File 'app/models/completion_kit/dataset.rb', line 8 def as_json( = {}) { id: id, name: name, csv_data: csv_data, created_at: created_at, updated_at: updated_at } end |
#row_count ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/models/completion_kit/dataset.rb', line 15 def row_count return 0 if csv_data.blank? require "csv" ::CSV.parse(csv_data, headers: true).length rescue ::CSV::MalformedCSVError 0 end |