Class: Inscriber::Uploader

Inherits:
Object
  • Object
show all
Includes:
TableHelpers
Defined in:
lib/inscriber/uploader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TableHelpers

#original_column_name, #original_table_name

Constructor Details

#initialize(opts) ⇒ Uploader

Returns a new instance of Uploader.



6
7
8
9
10
11
# File 'lib/inscriber/uploader.rb', line 6

def initialize(opts)
  @database = opts[:database]
  @table    = opts[:table]
  @records  = opts[:records]
  @locale   = opts[:locale]
end

Instance Attribute Details

#databaseObject

Returns the value of attribute database.



4
5
6
# File 'lib/inscriber/uploader.rb', line 4

def database
  @database
end

#localeObject

Returns the value of attribute locale.



4
5
6
# File 'lib/inscriber/uploader.rb', line 4

def locale
  @locale
end

#recordsObject

Returns the value of attribute records.



4
5
6
# File 'lib/inscriber/uploader.rb', line 4

def records
  @records
end

#tableObject

Returns the value of attribute table.



4
5
6
# File 'lib/inscriber/uploader.rb', line 4

def table
  @table
end

Instance Method Details

#uploadObject



13
14
15
16
17
# File 'lib/inscriber/uploader.rb', line 13

def upload
  records.each do |record|
    update_or_create_record(record)
  end
end