Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/chaocipher.rb
Instance Method Summary collapse
Instance Method Details
#rotate(n = 1) ⇒ Object
7 8 9 10 11 |
# File 'lib/chaocipher.rb', line 7 def rotate(n = 1) rotate_amount = n % size return self if rotate_amount < 1 # will be true if n < 1 or size < 2 self[rotate_amount..-1] + self[0..rotate_amount-1] end |