19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/table_structure/schema/class_methods.rb', line 19
def merge(*others)
others.each do |other|
unless ::TableStructure::Schema::Utils.schema_class?(other)
raise ::TableStructure::Error, "Must be a schema class. #{other}"
end
end
schema_classes = [self, *others]
::TableStructure::Schema.create_class do
@__column_definitions__ =
schema_classes
.map(&:column_definitions)
.flatten
@__context_builders__ =
schema_classes
.map(&:context_builders)
.reduce({}, &:merge!)
@__column_builders__ =
schema_classes
.map(&:column_builders)
.reduce({}, &:merge!)
@__row_builders__ =
schema_classes
.map(&:row_builders)
.reduce({}, &:merge!)
end
end
|