Module: ObjectTable::Stacking
- Included in:
- TableMethods
- Defined in:
- lib/object_table/stacking.rb
Defined Under Namespace
Modules: ClassMethods, InPlace
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.process_stackable_grid(grid, keys) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/object_table/stacking.rb', line 50
def self.process_stackable_grid(grid, keys)
case grid
when TableMethods
grid = grid.columns
when BasicGrid
grid._ensure_uniform_columns!
end
raise "Don't know how to join a #{grid.class}" unless grid.is_a?(BasicGrid)
return if grid.empty?
raise 'Mismatch in column names' unless !keys or ( (keys - grid.keys).empty? and (grid.keys - keys).empty? )
return grid
end
|
.stack_segments(segments) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/object_table/stacking.rb', line 39
def self.stack_segments(segments)
if segments.all?{|seg| seg.is_a? Array}
column = NArray.to_na(segments.flatten(1))
else
segments.map!{|seg| NArray.to_na seg}
column = Column._stack(segments)
end
end
|
Instance Method Details
#stack(*others) ⇒ Object
4
5
6
|
# File 'lib/object_table/stacking.rb', line 4
def stack(*others)
__table_cls__.stack(self, *others)
end
|