Method: Puppet::Pops::Types::TypeCalculator#tuple_entry_at
- Defined in:
- lib/puppet/pops/types/type_calculator.rb
#tuple_entry_at(tuple_t, from, to, index) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Produces the tuple entry at the given index given a tuple type, its from/to constraints on the last type, and an index. Produces nil if the index is out of bounds from must be less than to, and from may not be less than 0
787 788 789 790 791 792 793 794 795 796 797 |
# File 'lib/puppet/pops/types/type_calculator.rb', line 787 def tuple_entry_at(tuple_t, from, to, index) regular = (tuple_t.types.size - 1) if index < regular tuple_t.types[index] elsif index < regular + to # in the varargs part tuple_t.types[-1] else nil end end |