Class: CorrectHorseBatteryStaple::Writer::Base

Inherits:
CorrectHorseBatteryStaple::Writer show all
Includes:
Common
Defined in:
lib/correct_horse_battery_staple/writer/base.rb

Overview

Base class for all writers

Direct Known Subclasses

File, Redis, Sqlite

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#array_sample, #logger, #random_in_range, #random_number, #set_sample

Methods inherited from CorrectHorseBatteryStaple::Writer

make_writer, write

Constructor Details

#initialize(dest, options = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
# File 'lib/correct_horse_battery_staple/writer/base.rb', line 10

def initialize(dest, options = {})
  self.dest    = dest
  self.options = options
  initialize_backend_variables if respond_to?(:initialize_backend_variables)
end

Instance Attribute Details

#destObject

Returns the value of attribute dest.



8
9
10
# File 'lib/correct_horse_battery_staple/writer/base.rb', line 8

def dest
  @dest
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/correct_horse_battery_staple/writer/base.rb', line 8

def options
  @options
end

Instance Method Details

#closeObject



20
21
# File 'lib/correct_horse_battery_staple/writer/base.rb', line 20

def close
end

#write_corpus(corpus) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/correct_horse_battery_staple/writer/base.rb', line 16

def write_corpus(corpus)
  raise NotImplementedError, "#{self.class.name} is not a complete implementation"
end