lib/bindata/lazy.rb
# Returns the index in the closest ancestor array of this data object.
Returns the index in the closest ancestor array of this data object.
Returns the index in the closest ancestor array of this data object .
def array_index
      bindata_array_klass = BinData.const_defined?("Array") ? 
                              BinData.const_get("Array") : nil
      child = @obj
      parent = @obj.parent
      while parent
        if parent.class == bindata_array_klass
          return parent.index(child)
        end
        child = parent
        parent = parent.parent
      end
      raise NoMethodError, "no index found"
    end
def array_index bindata_array_klass = BinData . const_defined? ( "Array" ) ? BinData . const_get ( "Array" ) : nil child = @obj parent = @obj . parent while parent if parent . class == bindata_array_klass return parent . index ( child ) end child = parent parent = parent . parent end raise NoMethodError , "no index found" end
Returns the index in the closest ancestor array of this data object.
Returns the index in the closest ancestor array of this data object .