Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/mumuki/domain/extensions/array.rb
Instance Method Summary collapse
- #insert_last(element) ⇒ Object
- #multiple? ⇒ Boolean
- #randomize_with(randomizer, seed) ⇒ Object
- #single ⇒ Object
- #single! ⇒ Object
- #single? ⇒ Boolean
Instance Method Details
#insert_last(element) ⇒ Object
2 3 4 |
# File 'lib/mumuki/domain/extensions/array.rb', line 2 def insert_last(element) self + [element] end |
#multiple? ⇒ Boolean
19 20 21 |
# File 'lib/mumuki/domain/extensions/array.rb', line 19 def multiple? size > 1 end |
#randomize_with(randomizer, seed) ⇒ Object
23 24 25 |
# File 'lib/mumuki/domain/extensions/array.rb', line 23 def randomize_with(randomizer, seed) map { |it| it.randomize_with randomizer, seed } end |
#single ⇒ Object
6 7 8 |
# File 'lib/mumuki/domain/extensions/array.rb', line 6 def single first if single? end |
#single! ⇒ Object
10 11 12 13 |
# File 'lib/mumuki/domain/extensions/array.rb', line 10 def single! raise 'There is more than one element' unless single? first end |
#single? ⇒ Boolean
15 16 17 |
# File 'lib/mumuki/domain/extensions/array.rb', line 15 def single? size == 1 end |