Class: Group
- Includes:
- Comparable
- Defined in:
- lib/totally_lazy/sequence.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Attributes inherited from Sequence
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(key, enumerator) ⇒ Group
constructor
A new instance of Group.
Methods inherited from Sequence
#contains?, #cycle, drop, #drop, #drop_while, #each, empty, #exists?, #filter, #find, #find_index_of, #flat_map, #flatten, #fold, #fold_right, #for_all?, #group_by, #head, #head_option, #init, #inspect, #is_empty?, #join, #last, #last_option, #map, #map_concurrently, map_concurrently, #realise, #reduce, #reduce_right, #reject, repeat, repeat_fn, #reverse, #second, sequence, #size, sort, #sort_by, #tail, #take, take, #take_while, #to_a, #to_s, #zip, zip, #zip_with_index
Constructor Details
#initialize(key, enumerator) ⇒ Group
Returns a new instance of Group.
357 358 359 360 |
# File 'lib/totally_lazy/sequence.rb', line 357 def initialize(key, enumerator) super(enumerator) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
355 356 357 |
# File 'lib/totally_lazy/sequence.rb', line 355 def key @key end |
Instance Method Details
#<=>(other) ⇒ Object
362 363 364 |
# File 'lib/totally_lazy/sequence.rb', line 362 def <=>(other) (@key <=> other.key) <=> (enumerator.entries<=>(other.enumerator.entries)) end |