Autoyast erb disks helper methods

Is there any documentation for the extended ruby template helper ‘disks’ for use in autoyast?
Autoyast guide shows this example:
<% disk = disks.sort_by { |d| d[:size] }.last %>
So one method is last. Are there more? first, second, third? etc.
I’m trying to create autoyast to partition 3 different size logical drives and would like to use this helper to positively identify each logical drive by size.

I’m thinking I found a solution - just reference the array element instead of using .last.
For 3 logical drives:
<% disk = disks.sort_by { |d| d[:size] }[0] %> returns the smallest
<% disk = disks.sort_by { |d| d[:size] }[1] %> returns the drive that is 2nd largest
<% disk = disks.sort_by { |d| d[:size] }[2] %> returns the largest

Unfortunately didn’t work. Get failure reading control file during install.
Suspect that this example from KB is not sufficient:

<% disk = disks.sort_by { |d| d[:size] }.first %> <%= disk[:device] %> true all

Perhaps some of this in the scripts section is required?



/usr/bin/ruby
load_profile.rb
<![CDATA[#!/usr/bin/env ruby
require “yast”
require “autoinstall/y2erb”
helpers = Y2Autoinstallation::Y2ERB::TemplateEnvironment.new

Then call ‘helpers.disks’ in the partitioning section?

Anyone have any experience making erb work dynamically for autoyast install of sles15 sp5?

Here’s what worked for me for a 3 logical drive configuration (where logical drive order by size must be 1, 3, 2):

Because flash drives are used for install and autoinst.erb file, had to remove Flash Drives from the list or they become assigned to the install.
Disks helper has first and last methods but nothing to select 2nd largest from the list, so used array elements for selection.

1st logical drive - smallest size
<% mydisks = disks.select { |d| d[:model] != “Flash Drive” } %>
<% disk = mydisks.sort_by { |d| d[:size] }[0] %>
<%= “/dev/” + disk[:device] %>

2nd logical drive - largest size
<% disk = mydisks.sort_by { |d| d[:size] }[2] %>
<%= “/dev/” + disk[:device] %>

3rd logical drive
<% disk = mydisks.sort_by { |d| d[:size] }[1] %>
<%= “/dev/” + disk[:device] %>