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

Returns a new instance of Table.



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

def initialize(database, options = {})
  @database = database
  @name = options.fetch(:name)
  @columns = options.fetch(:columns)
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

Instance Method Details

#connectionObject



13
14
15
# File 'lib/txdb/table.rb', line 13

def connection
  database.connection.from(name)
end

#read_contentObject



17
18
19
# File 'lib/txdb/table.rb', line 17

def read_content
  database.backend.read_content_from(self)
end

#write_content(resource, locale) ⇒ Object



21
22
23
# File 'lib/txdb/table.rb', line 21

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