Method: Functional::Tuple#repeat
- Defined in:
- lib/functional/tuple.rb
#repeat(multiple) ⇒ Functional::Tuple Also known as: *
Returns a new tuple built by concatenating the given number of copies of self. Returns an empty tuple when the multiple is zero.
128 129 130 131 132 |
# File 'lib/functional/tuple.rb', line 128 def repeat(multiple) multiple = multiple.to_i raise ArgumentError.new('negative argument') if multiple < 0 Tuple.new(@data * multiple) end |