Module: Tablature::Model::ClassMethods
- Extended by:
- Forwardable
- Defined in:
- lib/tablature/model.rb
Instance Method Summary collapse
- #inspect ⇒ Object private
- #list_partition(partition_name = table_name) ⇒ Object
- #partitioned? ⇒ Boolean
- #range_partition(partition_name = table_name) ⇒ Object
- #tablature_partition ⇒ Object
Instance Method Details
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 53 54 55 56 |
# File 'lib/tablature/model.rb', line 50 def inspect return super unless partitioned? # Copied from the Rails source. attr_list = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ', ' "#{self}(#{attr_list})" end |
#list_partition(partition_name = table_name) ⇒ Object
39 40 41 42 |
# File 'lib/tablature/model.rb', line 39 def list_partition(partition_name = table_name) setup_partition(partition_name) extend(ListPartitionMethods) end |
#partitioned? ⇒ Boolean
20 21 22 23 24 25 26 27 28 |
# File 'lib/tablature/model.rb', line 20 def partitioned? begin tablature_partition rescue Tablature::MissingPartition return false end true end |
#range_partition(partition_name = table_name) ⇒ Object
44 45 46 47 |
# File 'lib/tablature/model.rb', line 44 def range_partition(partition_name = table_name) setup_partition(partition_name) extend(RangePartitionMethods) end |
#tablature_partition ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/tablature/model.rb', line 30 def tablature_partition partition = Tablature.database.partitioned_tables.find do |pt| pt.name == partition_name.to_s end raise Tablature::MissingPartition if partition.nil? partition end |