A data structure that provides information about a particular axis/dimension in a Structure. It provides access to the axis object, as well as the axis’s name (if any) and 0-based index into the list of axes. You should never need to create an AxisInfo yourself, but you can obtain one from NTable::Structure#axis.
The 0-based index of this axis in the structure. i.e. the first, most major axis has number 0.
The name of this axis in the structure as a string, or nil for no name.
The underlying axis implementation
Iterate over the labels, in order.
# File lib/ntable/structure.rb, line 128 def each if block_given? @axis_object.size.times do |i_| yield @axis_object.label(i_) end else to_enum end end
Standard equality check
# File lib/ntable/structure.rb, line 143 def eql?(obj_) obj_.is_a?(AxisInfo) && @axis_object.eql?(obj_.axis_object) && @axis_name.eql?(obj_.axis_name) end
Given a label object, return the corresponding 0-based integer index. Returns nil if the label is not recognized.
# File lib/ntable/structure.rb, line 103 def index(label_) @axis_object.index(label_) end
Basic output.
# File lib/ntable/structure.rb, line 80 def inspect "#<#{self.class}:0x#{object_id.to_s(16)} #{@axis_name}:#{@axis_object.class.name.sub('NTable::', '')}>" end
Given a 0-based integer index, return the corresponding label object. Returns nil if the index is out of bounds (i.e. is less than 0 or greater than or equal to size.)
# File lib/ntable/structure.rb, line 112 def label(index_) @axis_object.label(index_) end
Return the number of rows along this axis. An empty axis will return 0.
# File lib/ntable/structure.rb, line 121 def size @axis_object.size end