class DbToFile::Unloader::Table::Record::Field

Public Class Methods

new(field_name, record) click to toggle source
# File lib/db_to_file/unloader.rb, line 116
def initialize(field_name, record)
  @field_name = field_name
  @record     = record
end

Public Instance Methods

write_value(value) click to toggle source
# File lib/db_to_file/unloader.rb, line 121
def write_value(value)
  handle = File.open(full_file_path, 'w')
  handle.write(value)
  handle.close
end

Private Instance Methods

config() click to toggle source
# File lib/db_to_file/unloader.rb, line 144
def config
  Config.instance
end
config_field_extension() click to toggle source
# File lib/db_to_file/unloader.rb, line 140
def config_field_extension
  config.field_extension(@record.send(:table_name), @field_name)
end
file_with_extension() click to toggle source
# File lib/db_to_file/unloader.rb, line 132
def file_with_extension
  if (extension = config_field_extension).present?
    "#{@field_name}.#{extension}"
  else
    @field_name
  end
end
full_file_path() click to toggle source
# File lib/db_to_file/unloader.rb, line 128
def full_file_path
  File.join(@record.send(:base_dir), file_with_extension)
end