Class: FbUtils::Writer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/fb_utils/writers/base.rb

Direct Known Subclasses

Csv, Txt

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.



6
7
8
9
10
11
12
# File 'lib/fb_utils/writers/base.rb', line 6

def initialize(filename, options={})
  @options = options
  @options[:format] ||= "txt"
  @filename = File.basename(filename, ".#{options[:format]}") + ".#{options[:format]}"
  f = File.new(@filename, "w")
  f.close
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



4
5
6
# File 'lib/fb_utils/writers/base.rb', line 4

def filename
  @filename
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/fb_utils/writers/base.rb', line 4

def options
  @options
end

Instance Method Details

#writeObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/fb_utils/writers/base.rb', line 14

def write
  raise NotImplementedError
end