Class: Txdb::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, options = {}) ⇒ Table



8
9
10
11
12
13
# File 'lib/txdb/table.rb', line 8

def initialize(database, options = {})
  @database = database
  @name = options.fetch(:name)
  @columns = options.fetch(:columns)
  @source_lang = options.fetch(:source_lang)
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



5
6
7
# File 'lib/txdb/table.rb', line 5

def columns
  @columns
end

#databaseObject (readonly)

Returns the value of attribute database.



5
6
7
# File 'lib/txdb/table.rb', line 5

def database
  @database
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/txdb/table.rb', line 5

def name
  @name
end

#source_langObject (readonly)

Returns the value of attribute source_lang.



6
7
8
# File 'lib/txdb/table.rb', line 6

def source_lang
  @source_lang
end

Instance Method Details

#connectionObject



15
16
17
# File 'lib/txdb/table.rb', line 15

def connection
  database.connection.from(name)
end

#read_contentObject



19
20
21
# File 'lib/txdb/table.rb', line 19

def read_content
  database.backend.read_content_from(self)
end

#write_content(resource, locale) ⇒ Object



23
24
25
# File 'lib/txdb/table.rb', line 23

def write_content(resource, locale)
  database.backend.write_content_to(self, resource, locale)
end