{"id":28640780,"url":"https://github.com/pd/pluck_into","last_synced_at":"2025-08-11T19:21:09.052Z","repository":{"id":66371624,"uuid":"35299161","full_name":"pd/pluck_into","owner":"pd","description":"pluck_into(SomePORO, :foo, :bar)","archived":false,"fork":false,"pushed_at":"2015-05-08T20:17:01.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-12T20:08:23.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/pd/pluck_into","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/pd.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":"2015-05-08T20:00:36.000Z","updated_at":"2015-05-08T20:17:01.000Z","dependencies_parsed_at":"2023-02-20T16:15:55.359Z","dependency_job_id":null,"html_url":"https://github.com/pd/pluck_into","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pd/pluck_into","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pd%2Fpluck_into","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pd%2Fpluck_into/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pd%2Fpluck_into/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pd%2Fpluck_into/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pd","download_url":"https://codeload.github.com/pd/pluck_into/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pd%2Fpluck_into/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269941272,"owners_count":24500660,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-06-12T20:08:23.078Z","updated_at":"2025-08-11T19:21:09.024Z","avatar_url":"https://github.com/pd.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pluck_into [![Build Status](https://travis-ci.org/pd/pluck_into.svg?branch=master)](https://travis-ci.org/pd/pluck_into)\n\n`ActiveRecord::Base#pluck` is great, but I often find myself mapping over its return\nvalue to wrap each row into a domain object of some kind.\n\n`pluck_into` wraps that pattern up.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'pluck_into'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install pluck_into\n\n## Usage\n\n```ruby\nresults = FooRecord.pluck_into(SomeType, :bar, :baz)\nresults.first.bar\nresults.first.baz\n```\n\n## Caveats\n\nCurrently only supports objects with an `initialize` method similar to `OpenStruct`, `ActiveModel::Model`, etc:\n\n```ruby\ndef initialize(attributes={})\n```\n\nThis is the more common case in my usage. I would love to support plucking into a `Struct`, but haven't yet come up with a reasonable means of differentiating between the forms:\n\n```ruby\nBigWidget = Struct.new(:name, :size)\nWidget.pluck_into(BigWidget, :name, :size)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n1. Fork it ( https://github.com/pd/pluck_into/fork )\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 a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpd%2Fpluck_into","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpd%2Fpluck_into","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpd%2Fpluck_into/lists"}