Class: RbLovely::SortedSet
Overview
A SortedSet should not be modified during iteration.
Some methods come from the Enumerable module. If you do not find the method you are looking for in this documentation then please look there.
Implement a sorted set with no duplicates where values are compared and sorted using the <=> operator on each member.
Class Method Summary collapse
-
.[](*content) ⇒ SortedSet
Factory method for creating sorted set from array.
Instance Method Summary collapse
-
#delete(value) ⇒ Object
Deletes first member equivalent to value.
-
#each(&block) ⇒ Object
Calls block once with each value in the set.
-
#empty? ⇒ Boolean
Return true if the set is empty.
-
#first ⇒ Object
Access the first element in the set.
-
#initialize(content = []) ⇒ SortedSet
constructor
A new instance of SortedSet.
-
#last ⇒ Object
Access the last element in the set.
-
#length ⇒ Number
Gets the number of elements in the set.
-
#pop ⇒ Object
Remove the last element from the set.
-
#reject!(&predicate) ⇒ Object
Remove elements from the set match a given predicate.
-
#reject_first!(&predicate) ⇒ Object
Remove the first element from the set that matches the given predicate.
-
#select!(&predicate) ⇒ Object
Remove elements from the set that do not match a given predicate.
-
#shift ⇒ Object
Remove the first element from the set.
Constructor Details
#initialize(content = []) ⇒ SortedSet
Returns a new instance of SortedSet.
44 |
# File 'yard.rb', line 44 def initialize content = [] ; end |
Class Method Details
.[](*content) ⇒ SortedSet
Factory method for creating sorted set from array.
53 |
# File 'yard.rb', line 53 def self.[](*content) ; end |
Instance Method Details
#delete(value) ⇒ Object
Deletes first member equivalent to value.
63 |
# File 'yard.rb', line 63 def delete value ; end |
#each(&block) ⇒ Object
Calls block once with each value in the set.
131 |
# File 'yard.rb', line 131 def each(&block) ; end |
#empty? ⇒ Boolean
Return true if the set is empty.
141 |
# File 'yard.rb', line 141 def empty? ; end |
#first ⇒ Object
Access the first element in the set.
71 |
# File 'yard.rb', line 71 def first ; end |
#last ⇒ Object
Access the last element in the set.
79 |
# File 'yard.rb', line 79 def last ; end |
#length ⇒ Number
Gets the number of elements in the set.
136 |
# File 'yard.rb', line 136 def length ; end |
#pop ⇒ Object
Remove the last element from the set.
97 |
# File 'yard.rb', line 97 def pop ; end |
#reject!(&predicate) ⇒ Object
Remove elements from the set match a given predicate.
106 |
# File 'yard.rb', line 106 def reject!(&predicate) ; end |
#reject_first!(&predicate) ⇒ Object
Remove the first element from the set that matches the given predicate.
115 |
# File 'yard.rb', line 115 def reject_first!(&predicate) ; end |
#select!(&predicate) ⇒ Object
Remove elements from the set that do not match a given predicate.
124 |
# File 'yard.rb', line 124 def select!(&predicate) ; end |
#shift ⇒ Object
Remove the first element from the set.
88 |
# File 'yard.rb', line 88 def shift ; end |