Class: CorrectHorseBatteryStaple::Writer::Sqlite
- Inherits:
-
Base
- Object
- CorrectHorseBatteryStaple::Writer
- Base
- CorrectHorseBatteryStaple::Writer::Sqlite
- Defined in:
- lib/correct_horse_battery_staple/writer/sqlite.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(dest, options = {}) ⇒ Sqlite
constructor
A new instance of Sqlite.
-
#write_corpus(corpus) ⇒ Object
select * from entries where percentile < 30 and percentile > 20 and wordlength >= 9 and wordlength <= 12 order by RANDOM() limit 6;.
Methods inherited from Base
Methods included from Common
#array_sample, #logger, #random_in_range, #random_number, #set_sample
Methods inherited from CorrectHorseBatteryStaple::Writer
Constructor Details
#initialize(dest, options = {}) ⇒ Sqlite
Returns a new instance of Sqlite.
6 7 8 |
# File 'lib/correct_horse_battery_staple/writer/sqlite.rb', line 6 def initialize(dest, ={}) super end |
Instance Method Details
#write_corpus(corpus) ⇒ Object
select * from entries where percentile < 30 and percentile > 20 and wordlength >= 9 and wordlength <= 12 order by RANDOM() limit 6;
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/correct_horse_battery_staple/writer/sqlite.rb', line 11 def write_corpus(corpus) create_database @db.transaction do save_entries(@db, corpus) save_stats(@db, corpus.stats) end rescue logger.error "error in SQLite write_corpus: #{$!.inspect}" raise ensure close_database end |