Class: ObjectTable::MaskedColumn
- Inherits:
-
NArray
- Object
- NArray
- ObjectTable::MaskedColumn
- Defined in:
- lib/object_table/masked_column.rb
Constant Summary collapse
- EMPTY =
NArray[]
Instance Attribute Summary collapse
-
#indices ⇒ Object
Returns the value of attribute indices.
-
#parent ⇒ Object
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#indices ⇒ Object
Returns the value of attribute indices.
4 5 6 |
# File 'lib/object_table/masked_column.rb', line 4 def indices @indices end |
#parent ⇒ Object
Returns the value of attribute parent.
4 5 6 |
# File 'lib/object_table/masked_column.rb', line 4 def parent @parent end |
Class Method Details
.mask(parent, indices) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/object_table/masked_column.rb', line 8 def self.mask(parent, indices) if parent.empty? masked = parent.slice(indices) else masked = parent.slice(false, indices) end if masked.rank <= 0 column = new(masked.typecode, 0) else column = cast(masked) end column.parent = parent column.indices = indices column end |
Instance Method Details
#[]=(*keys, value) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/object_table/masked_column.rb', line 26 def []=(*keys, value) unless parent.nil? or ((value.is_a?(Array) or value.is_a?(NArray)) and value.empty?) parent[false, indices[*keys]] = value end super end |
#clone ⇒ Object
42 43 44 45 |
# File 'lib/object_table/masked_column.rb', line 42 def clone return NArray.new(typecode, 0) if empty? NArray.cast(self).clone end |
#coerce_rev(other, operator) ⇒ Object
47 48 49 50 |
# File 'lib/object_table/masked_column.rb', line 47 def coerce_rev(other, operator) return other.send(operator, EMPTY) if empty? other.send(operator, NArray.cast(self)) end |