{"id":16019601,"url":"https://github.com/iboard/sorted_array","last_synced_at":"2025-04-05T03:25:09.135Z","repository":{"id":56896487,"uuid":"10581850","full_name":"iboard/sorted_array","owner":"iboard","description":"A Gem providing class SortedArray which keeps sorted after inserting items. A DefaultSorter-class is included. DefaultSorter.new(:foo) expects an object which responds_to :foo and sorts by a.foo \u003c=\u003e b.foo. SortedArray defines marshal_dump and marshal_load to support using SortedArray with PStore.","archived":false,"fork":false,"pushed_at":"2013-06-10T12:26:38.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T08:08:48.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iboard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-09T10:40:42.000Z","updated_at":"2013-10-02T17:16:11.000Z","dependencies_parsed_at":"2022-08-20T17:10:29.688Z","dependency_job_id":null,"html_url":"https://github.com/iboard/sorted_array","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fsorted_array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fsorted_array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fsorted_array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fsorted_array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboard","download_url":"https://codeload.github.com/iboard/sorted_array/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247283362,"owners_count":20913561,"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":[],"created_at":"2024-10-08T17:04:53.326Z","updated_at":"2025-04-05T03:25:09.093Z","avatar_url":"https://github.com/iboard.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SortedArray\n\nThe gem is providing a class `SortedArray` which keeps sorted\nafter adding new items. When initializing a `SortedArray` you chose\na Sorter which must have a method `:sort`\n\nSorter-classes `DefaultSorter` and `ReverseSorter` are included.\n\nThe included `DefaultSorter` sorts a list of Objects by a given method-name.\nThe included `ReverseSorter` sorts a list of Objects by a given method-name and then reverses it.\n\n\n## Installation\n\n  * see [RubyGems](http://rubygems.org/gems/sorted_array)\n  * see [Github](https://github.com/iboard/sorted_array#readme)\n\nAdd this line to your application's Gemfile:\n\n    gem 'sorted_array' \n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install sorted_array\n    \nRun Tests\n\n_If you clone from github you can run the following tasks:_\n\n\n    $ git clone git://github.com/iboard/sorted_array.git\n    $ cd sorted_array\n    $ bundle               # update/install the bundle\n    $ rake                 # run all tests\n    $ rspec spec/          # run all specs manually\n    $ guard                # start guard\n\n## Documentation\n\n    $ yard\n    $ open doc/index.html  # on Mac OS X\n\nA copy of the YARDocumentation can be found at\n[iboard.cc - yardoc](http://dav.iboard.cc/container/sorted_array_doc/)\n\nAnd a copy of the last coverage-report is at\n[iboard.cc - coverage](http://dav.iboard.cc/container/sorted_array_coverage/)\n\n## Usage-example\n\n    data = [\n      OpenStruct.new( foo: 1 ),\n      OpenStruct.new( foo: 3 ),\n      OpenStruct.new( foo: 2 )\n    ]\n    keep_sorted   = SortedArray.new( DefaultSorter.new(:foo), data )\n    keep_reversed = SortedArray.new( ReverseSorter.new(:foo), data )\n    keep_sorted   \u003c\u003c OpenStruct.new( foo: 0 )\n    keep_reversed \u003c\u003c OpenStruct.new( foo: 0 )\n    \n    # data.map(\u0026:foo) =\u003e [1,3,2]\n    # keep_sorted.map(\u0026:foo) =\u003e [0,1,2,3]\n    # keep_reversed.map(\u0026:foo) =\u003e [3,2,1,0]\n    \n## Persistent\n\n_SortedArray_ defines a `marshal_load` and `marshal_dump` method and\ncan be used in a `PStore`\n\nExample:\n\n    # assumes the previous example was executed before\n     \n    store=PStore.new('example.pstore')\n    store.transaction do |w|\n      w[:data] = keep_sorted\n    end\n    \n    from_disk = []\n    store.trasaction(true) do |r|\n      from_disk = r[:data]\n    end\n    \n    # from_disk.map(\u0026:foo) =\u003e [0,1,2,3]\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nCopyright (c) 2013 Andi Altendorfer\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fsorted_array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiboard%2Fsorted_array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fsorted_array/lists"}