Class: Txdb::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/txdb/uploader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ Uploader

Returns a new instance of Uploader.



11
12
13
# File 'lib/txdb/uploader.rb', line 11

def initialize(database)
  @database = database
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



9
10
11
# File 'lib/txdb/uploader.rb', line 9

def database
  @database
end

Class Method Details

.upload(database) ⇒ Object



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

def upload(database)
  new(database).upload
end

Instance Method Details

#uploadObject



15
16
17
18
19
# File 'lib/txdb/uploader.rb', line 15

def upload
  database.tables.each do |table|
    upload_table(table)
  end
end

#upload_table(table) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/txdb/uploader.rb', line 21

def upload_table(table)
  table.read_content.each do |resource|
    transifex_api.create_or_update(
      resource.original, resource.content
    )
  end
end