A coordinate into a table. This object is often provided during iteration to indicate where you are in the iteration. You should not need to create a Position object yourself.
Returns the label of the coordinate along the given axis. The axis may be provided by name or index.
# File lib/ntable/structure.rb, line 218 def coord(axis_) ainfo_ = @structure.axis(axis_) ainfo_ ? _coords[ainfo_.axis_index] : nil end
Returns an array of all coordinate labels along the axes in order.
# File lib/ntable/structure.rb, line 228 def coord_array _coords.dup end
Standard equality check
# File lib/ntable/structure.rb, line 199 def eql?(obj_) obj_.is_a?(Position) && obj_.structure.eql?(@structure) && obj_._offset.eql?(self._offset) end
Standard hash value
# File lib/ntable/structure.rb, line 207 def hash @structure.hash + @vector.hash end
Basic output.
# File lib/ntable/structure.rb, line 191 def inspect "#<#{self.class}:0x#{object_id.to_s(16)} #{coord_array.inspect}>" end
Returns the Position of the “next” cell in the table, or nil if this is the last cell.
# File lib/ntable/structure.rb, line 236 def next v_ = @vector.dup @structure._inc_vector(v_) ? nil : Position.new(@structure, v_) end
Returns the Position of the “previous” cell in the table, or nil if this is the first cell.
# File lib/ntable/structure.rb, line 245 def prev v_ = @vector.dup @structure._dec_vector(v_) ? nil : Position.new(@structure, v_) end