Class: RStore::BaseTable
Class Attribute Summary collapse
-
.table_classes ⇒ Hash{Symbol=>BaseTable}
readonly
A Hash holding subclasses of BaseTable.
Class Method Summary collapse
-
.create { ... } ⇒ void
Define the table layout.
- .inherited(subclass) ⇒ Object
-
.name ⇒ Symbol
The lower-case class name without the Table postfix.
Class Attribute Details
.table_classes ⇒ Hash{Symbol=>BaseTable} (readonly)
A Hash holding subclasses of RStore::BaseTable
21 22 23 |
# File 'lib/rstore/base_table.rb', line 21 def table_classes @table_classes end |
Class Method Details
.create { ... } ⇒ void
Note:
To be called when defining of a subclass of RStore::BaseTable
Note:
You need to define an extra column for an auto-incrementing primary key.
This method returns an undefined value.
Define the table layout.
50 51 52 53 54 55 56 |
# File 'lib/rstore/base_table.rb', line 50 def self.create &block class << self attr_reader :table_info end @table_info = block end |
.inherited(subclass) ⇒ Object
26 27 28 |
# File 'lib/rstore/base_table.rb', line 26 def self.inherited subclass BaseTable.table_classes[subclass.name] = subclass end |
.name ⇒ Symbol
Returns The lower-case class name without the Table postfix.
87 88 89 |
# File 'lib/rstore/base_table.rb', line 87 def self.name super.gsub!(/Table/,'').downcase.to_sym end |