aboutsummaryrefslogtreecommitdiffstats
path: root/lib/set.rb
Commit message (Collapse)AuthorAgeFilesLines
* * lib/set.rb: [DOC] add documentation that ↵ktsj2016-05-041-4/+11
| | | | | | | | Set#{delete_if,keep_if,collect!,reject!,select!, classify,divide} without block returns an enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#{delete_if,keep_if,collect!,reject!,select!,classify,divide},ktsj2016-05-041-9/+9
| | | | | | | | SortedSet#{delete_if,keep_if}): Return sized enumerators. * test/test_set.rb: add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: Enable frozen_string_literal.knu2015-11-161-1/+3
| | | | | | * lib/set.rb: Move << out of the begin block that ensures pop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Explain the reason for calling do_with_enum without a block [ci skip]knu2015-11-161-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Hash#flatten!, #add?, #delete?, #collect!, #reject!,knu2015-11-161-23/+8
| | | | | | | #select!, #^, #classify): Micro-optimize some methods for performance and readability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (#>=, #>, #<=, #<): Make use of Hash#>=, #>, #<, andknu2015-11-161-12/+32
| | | | | | #<= when comparing against an instance of the same kind. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: Make Set#each and SortedSet#each generate a sizedknu2015-06-151-2/+2
| | | | | | | | | enumerator. [GH-931] by kachick (Kenichi Kamiya) * test/test_set.rb: Import tests from Set into SortedSet. [GH-931] by kachick (Kenichi Kamiya) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c: Added docs to explain that #include? and #member? do nothsbt2015-02-171-0/+5
| | | | | | | check member equality * lib/set.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* set: speed up Set#include?normal2015-02-111-2/+2
| | | | | | | | | | * lib/set.rb (initialize): internal hash defaults to false * lib/set.rb (include?): use Hash#[] for optimized dispatch. Patch by Ismael Abreu <ismaelga@gmail.com> [ruby-core:67664] [Misc #10754] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#replace): Check if an object given is enumerableknu2014-08-061-4/+4
| | | | | | | before clearing self. Reported by yui-knk. [GH-675] https://github.com/ruby/ruby/pull/675 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Implement Set#clone. [Fixes GH-661]knu2014-08-061-2/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: [DOC] Fix grammatical error by @bouk [fix GH-524]hsbt2014-02-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: [DOC] Add examples for Set#intersect? and Set#disjoint?zzak2014-01-281-0/+13
| | | | | | | Patch by xavier nayrac [Bug #9331] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (class SortedSet): Fix source_location for methods defined via ↵tmm12013-11-221-4/+4
| | | | | | eval. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: [DOC] Add a couple of notes on Hash as storage.knu2013-07-311-3/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: [DOC] Fix example result. Hash is now ordered.knu2013-07-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use the term "sorted" instead "ordered" when mentioning SortSet.knu2013-07-311-1/+1
| | | | | | | * lib/set.rb: [DOC] Use the term "sorted" instead "ordered" when mentioning SortSet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add Set#intersect? and #disjoint?.knu2013-07-301-0/+17
| | | | | | | | * lib/set.rb (Set#intersect?, Set#disjoint?): Add new methods for testing if two sets have any element in common. [ruby-core:45641] [Feature #6588] Based on the code by marcandre. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Define Set#to_set so that aSet.to_set returns self.knu2013-07-191-0/+10
| | | | | | | * lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set returns self. [Fixes GH-359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#freeze, taint, untaint): Save a "self" byknu2013-06-011-6/+3
| | | | | | utilizing super returning self, and add tests while at it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#delete_if, Set#keep_if): Avoid blockless call ofknu2013-05-201-3/+3
| | | | | | | proc, which is not portable to JRuby. Replace &method() with faster and simpler literal blocks while at it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#delete_if, Set#keep_if): Add comments.knu2013-05-191-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#delete_if, Set#keep_if): Make Set#delete_if andknu2013-05-181-2/+2
| | | | | | Set#keep_if more space and time efficient by avoiding to_a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Move tests embedded in lib/set.rb to test/test_set.rb.knu2012-11-241-644/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Drop executable bits.knu2012-11-221-0/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (#initialize_copy, #eql): Use instance_variable_getknu2012-09-011-2/+2
| | | | | | instead of instance_eval. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#{each,reject!,select!}, SortedSet#each): Passknu2012-08-311-12/+12
| | | | | | | the original block through instead of creating one that only yields the passed argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#{<,>,<=,>=}): Define comparison operators asknu2012-08-301-0/+23
| | | | | | | shorthand for the {proper_}{subset?,superset?} methods (finally). Given a push by Alexander E. Fischer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (SortedSet.setup): remove old_init after initializeakr2011-11-201-0/+4
| | | | | | | | | method is redefined. The remove before redefinition makes the warning prevention fragile. [ruby-dev:44892] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (SortedSet.setup): don't remove old_init. The removeakr2011-11-201-1/+0
| | | | | | | makes the warning prevention fragile. [ruby-dev:44892] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/pathname/lib/pathname.rb, ext/tk/lib/multi-tk.rb,ktsj2011-11-051-2/+2
| | | | | | | | | | | | | ext/tk/sample/demos-en/widget, lib/benchmark.rb, lib/irb/cmd/fork.rb, lib/mkmf.rb, lib/net/ftp.rb, lib/net/smtp.rb, lib/open3.rb, lib/pstore.rb, lib/rexml/element.rb, lib/rexml/light/node.rb, lib/rinda/tuplespace.rb, lib/rss/maker/base.rb, lib/rss/maker/entry.rb, lib/scanf.rb, lib/set.rb, lib/shell.rb, lib/shell/command-processor.rb, lib/shell/process-controller.rb, lib/shell/system-command.rb, lib/uri/common.rb: remove unused block arguments to avoid creating Proc objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib: revert r31635-r31638 and untabify with expand(1).nobu2011-05-191-253/+253
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib: Convert tabs to spaces for ruby files perdrbrain2011-05-181-279/+279
| | | | | | | | | http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style Patch by Steve Klabnik [Ruby 1.9 - Bug #4730] Patch by Jason Dew [Ruby 1.9 - Feature #4718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.nobu2011-05-151-10/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (class Set): Add nodoc to internal-use methods. Patch by ↵drbrain2011-05-111-2/+2
| | | | | | Pete Higgins. [Ruby 1.9 - Bug #4665] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#replace): Apply a bit of optimization.knu2010-10-101-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (keep_if, select!): New methods [ruby-core:29749]marcandre2010-05-301-0/+25
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fri Feb 12 02:27:39 2010 Akinori MUSHA <knu@iDaemons.org>knu2010-02-111-10/+16
| | | | | | | | | | | * lib/set.rb (Set#initialize, Set#replace, Set#merge) (Set#subtract, Set#&): Fix duck type tests. [ruby-core:28078] * lib/set.rb (Set#initialize, Set#replace, Set#merge) (Set#subtract, Set#&): Try #each if #each_entry fails. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_entry): new method #each_entry to pack valuesmatz2010-02-021-15/+15
| | | | | | | | | | | | | | from yield into an array. * lib/set.rb (Set#merge): use Enumerable#each_entry to implement Set compatible to 1.8 behavior. [ruby-core:27985] * lib/set.rb: replace is_a?(Enumerable) with respond_to?(:each) for duck typing. * lib/set.rb (SortedSet#add): typo fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb: Add checks that passed argument is Enumerable. [ruby-core:23844]marcandre2009-12-191-2/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (==): Optimization; patch by Arthur Schreiber [ruby-core:17203]marcandre2009-09-131-7/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (SortedSet#add): Do not require each newly addedknu2009-05-071-4/+4
| | | | | | | | element to be Comparable but to respond to <=>. [ruby-dev:38371] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (SortedSet): Fix document. [Bug #1429]knu2009-05-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#merge): Only directly use the passed objectsknu2009-05-011-2/+2
| | | | | | | | @hash instance variable when self and the passed object are instances of the same class. [Bug #118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (SortedSet#add): Do not let an uncomparable objectknu2009-05-011-4/+38
| | | | | | | in. [Bug #118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-27/+27
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * golf_prelude.rb, lib/set.rb (TC_Set#test_each),knu2008-08-131-1/+1
| | | | | | | | | | | | | test/readline/test_readline_history.rb (Readline#test_each__enumerator), test/ruby/test_array.rb (TestArray#test_collect), test/ruby/test_enumerator.rb (TestEnumerator#test_initialize): Enumerable::Enumerator is now called Enumerator. * lib/rinda/tuplespace.rb (Rinda::TupleBag#initialize): Use enum_for instead of hardcoding Enumerable::Enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#delete_if): Call to_a.knu2008-06-091-3/+29
| | | | | | | | | | | | (SortedSet#delete_if, TC_SortedSet#test_sortedset): Use super to yield elements in sorted order; [ruby-core:17144] by Arthur Schreiber. (SortedSet#each, SortedSet#each, TC_Set#test_each) (TC_SortedSet#test_sortedset): Return self; [ruby-dev:35002] by Arthur Schreiber. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/set.rb (Set#classify): Back out the `group_by' alias.knu2008-06-031-1/+0
| | | | | | | Better think twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Properly back out.knu2008-06-031-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e