Class: BomDB::Import::Editions
- Inherits:
-
Import::Base
- Object
- Import::Base
- BomDB::Import::Editions
- Defined in:
- lib/bomdb/import/editions.rb
Instance Method Summary collapse
-
#import_json(data, **args) ⇒ Object
Expected data format is: [ [edition_year:Integer, edition_name:String], ... ].
Instance Method Details
#import_json(data, **args) ⇒ Object
Expected data format is: [ [edition_year:Integer, edition_name:String], ... ]
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bomdb/import/editions.rb', line 13 def import_json(data, **args) data.each do |year, name| @db[:editions].insert( edition_year: year, edition_name: name ) end Import::Result.new(success: true) rescue Sequel::UniqueConstraintViolation => e Import::Result.new(success: false, error: e) end |