I have a test that includes character lengths within fields etc.
I was wondering if I could have a set string of 10 characters like
str = 'abcdefghij'
String#* would do:
'abc' * 10 #⇒ "abcabcabcabcabcabcabcabcabcabc"
To use a floating point parameter:
λ = ->(input, count) do i, f = *count.divmod(1) input * i << input[0...(f * input.size).to_i] end λ.('abcd', 2.5) #⇒ 'abcdabcdab'