Class: Immutable::Splitter::Right
- Inherits:
-
Realizable
- Object
- Realizable
- Immutable::Splitter::Right
- Defined in:
- lib/immutable/list.rb
Constant Summary
Constants included from List
Instance Method Summary collapse
-
#initialize(splitter, mutex) ⇒ Right
constructor
A new instance of Right.
- #realize ⇒ Object
Methods inherited from Realizable
#cached_size?, #empty?, #head, #realized?, #size, #tail
Methods included from List
#<<, [], #add, #append, #at, #break, #cached_size?, #chunk, #clear, #combination, #cycle, #delete, #delete_at, #drop, #drop_while, #dup, #each, #each_chunk, empty, #eql?, #fill, #flat_map, #flatten, from_enum, #group_by, #hash, #indices, #init, #inits, #insert, #inspect, #intersperse, #last, #map, #merge, #merge_by, #partition, #permutation, #pop, #pretty_print, #respond_to?, #reverse, #rotate, #sample, #select, #size, #slice, #sort, #sort_by, #span, #split_at, #subsequences, #tails, #take, #take_while, #to_list, #transpose, #union, #uniq, #zip
Methods included from Enumerable
#<=>, #==, #compact, #each_index, #grep, #grep_v, #group_by, #inspect, #join, #partition, #pretty_print, #product, #reject, #sort_by, #sum, #to_set
Methods included from Enumerable
Constructor Details
#initialize(splitter, mutex) ⇒ Right
Returns a new instance of Right.
1539 1540 1541 1542 |
# File 'lib/immutable/list.rb', line 1539 def initialize(splitter, mutex) super() @splitter, @mutex = splitter, mutex end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Immutable::List
Instance Method Details
#realize ⇒ Object
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 |
# File 'lib/immutable/list.rb', line 1544 def realize mutex = @mutex mutex && mutex.synchronize do return if @head != Undefined @splitter.next_item until @splitter.done? if @splitter.right.empty? @head, @size, @tail = nil, 0, self else @head, @tail = @splitter.right.head, @splitter.right.tail end @splitter, @mutex = nil, nil end end |