Module: CascadingConfiguration::Array::Sorted::CompositingArray::Interface
- Defined in:
- lib/cascading-configuration-array-sorted.rb,
lib/cascading-configuration-array-sorted/_private_/CascadingConfiguration/Array/Sorted/CompositingArray/Interface.rb
Instance Method Summary collapse
-
#collect! ⇒ Object
(also: #map!)
collect! # map! #.
-
#reverse! ⇒ Object
reverse! #.
-
#sort!(&block) ⇒ Object
sort! #.
-
#sort_by!(&block) ⇒ Object
sort_by! #.
Instance Method Details
#collect! ⇒ Object Also known as: map!
collect! #
map! #
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cascading-configuration-array-sorted/_private_/CascadingConfiguration/Array/Sorted/CompositingArray/Interface.rb', line 25 def collect! return to_enum unless block_given? replacement_array = [ ] self.each_with_index do |this_object, index| replacement_object = yield( this_object ) replacement_array[ index ] = replacement_object end replace( replacement_array ) return self end |
#reverse! ⇒ Object
reverse! #
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cascading-configuration-array-sorted/_private_/CascadingConfiguration/Array/Sorted/CompositingArray/Interface.rb', line 8 def reverse! @sort_order_reversed = ! @sort_order_reversed super @sub_composite_arrays.each do |this_sub_array| this_sub_array.reverse! end end |
#sort!(&block) ⇒ Object
sort! #
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cascading-configuration-array-sorted/_private_/CascadingConfiguration/Array/Sorted/CompositingArray/Interface.rb', line 46 def sort!( & block ) if block_given? self.each_with_index do |this_member, index| unless index + 1 == count yield( this_member, self[ index + 1 ] ) end end end return self end |
#sort_by!(&block) ⇒ Object
sort_by! #
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/cascading-configuration-array-sorted/_private_/CascadingConfiguration/Array/Sorted/CompositingArray/Interface.rb', line 64 def sort_by!( & block ) return to_enum unless block_given? self.each do |this_member| yield( this_member ) end return self end |