Class: Inscriber::Uploader
- Inherits:
-
Object
- Object
- Inscriber::Uploader
- Includes:
- TableHelpers
- Defined in:
- lib/inscriber/uploader.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#records ⇒ Object
Returns the value of attribute records.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Uploader
constructor
A new instance of Uploader.
- #upload ⇒ Object
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
#database ⇒ Object
Returns the value of attribute database.
4 5 6 |
# File 'lib/inscriber/uploader.rb', line 4 def database @database end |
#locale ⇒ Object
Returns the value of attribute locale.
4 5 6 |
# File 'lib/inscriber/uploader.rb', line 4 def locale @locale end |
#records ⇒ Object
Returns the value of attribute records.
4 5 6 |
# File 'lib/inscriber/uploader.rb', line 4 def records @records end |
#table ⇒ Object
Returns the value of attribute table.
4 5 6 |
# File 'lib/inscriber/uploader.rb', line 4 def table @table end |
Instance Method Details
#upload ⇒ Object
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 |