{"id":13878717,"url":"https://github.com/ruby/set","last_synced_at":"2025-05-16T06:05:08.329Z","repository":{"id":40297846,"uuid":"266091781","full_name":"ruby/set","owner":"ruby","description":"This library provides the Set class, which deals with a collection of unordered values with no duplicates.","archived":false,"fork":false,"pushed_at":"2025-05-12T08:29:40.000Z","size":246,"stargazers_count":22,"open_issues_count":5,"forks_count":15,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-05-12T08:55:49.080Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-22T11:16:18.000Z","updated_at":"2025-05-12T08:29:34.000Z","dependencies_parsed_at":"2024-09-28T21:01:13.514Z","dependency_job_id":"05bfbad1-8298-4fde-b1e9-20a16768d60b","html_url":"https://github.com/ruby/set","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/set/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478187,"owners_count":22077676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby"],"created_at":"2024-08-06T08:01:57.617Z","updated_at":"2025-05-16T06:05:08.311Z","avatar_url":"https://github.com/ruby.png","language":"Ruby","readme":"# Set\n\nThis library provides the Set class, which deals with a collection of\nunordered values with no duplicates.  It is a hybrid of Array's\nintuitive inter-operation facilities and Hash's fast lookup.\n\nThe method `to_set` is added to Enumerable for convenience.\n\nSet implements a collection of unordered values with no duplicates.\nThis is a hybrid of Array's intuitive inter-operation facilities and\nHash's fast lookup.\n\nSet is easy to use with Enumerable objects (implementing `each`).\nMost of the initializer methods and binary operators accept generic\nEnumerable objects besides sets and arrays.  An Enumerable object can\nbe converted to Set using the `to_set` method.\n\nSet uses Hash as storage, so you must note the following points:\n\n* Equality of elements is determined according to Object#eql? and\n  Object#hash.  Use Set#compare_by_identity to make a set compare its\n  elements by their identity.\n\n* Set assumes that the identity of each element does not change while\n  it is stored.  Modifying an element of a set will render the set to\n  an unreliable state.\n\n* When a string is to be stored, a frozen copy of the string is stored\n  instead unless the original string is already frozen.\n\n### Comparison\n\nThe comparison operators `\u003c`, `\u003e`, `\u003c=`, and `\u003e=` are implemented as\nshorthand for the {proper_,}{subset?,superset?} methods.  The `\u003c=\u003e`\noperator reflects this order, or return `nil` for sets that both have\ndistinct elements (`{x, y}` vs. `{x, z}` for example).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'set'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install set\n\n## Usage\n\n```ruby\nrequire 'set'\ns1 = Set[1, 2]                        #=\u003e #\u003cSet: {1, 2}\u003e\ns2 = [1, 2].to_set                    #=\u003e #\u003cSet: {1, 2}\u003e\ns1 == s2                              #=\u003e true\ns1.add(\"foo\")                         #=\u003e #\u003cSet: {1, 2, \"foo\"}\u003e\ns1.merge([2, 6])                      #=\u003e #\u003cSet: {1, 2, \"foo\", 6}\u003e\ns1.subset?(s2)                        #=\u003e false\ns2.subset?(s1)                        #=\u003e true\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ruby/set.\n\nFeature requests should also go to https://bugs.ruby-lang.org/ for wider audience and discussion.\n\n## License\n\nThe gem is available as open source under either the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).  When bundled with Ruby, you can distribute/modify this program under the same terms of [Ruby](https://www.ruby-lang.org/en/about/license.txt).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fset/lists"}