{"id":20487040,"url":"https://github.com/wendy0402/simple_csv_creator","last_synced_at":"2026-05-27T13:37:54.032Z","repository":{"id":56895746,"uuid":"79614495","full_name":"wendy0402/simple_csv_creator","owner":"wendy0402","description":"DSL to create CSV. Highly inspired by activeadmin csv","archived":false,"fork":false,"pushed_at":"2017-01-21T01:21:47.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T10:42:37.501Z","etag":null,"topics":["activeadmin-csv","csv","dsl","generator","ruby"],"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/wendy0402.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-21T01:11:11.000Z","updated_at":"2018-07-25T08:59:05.000Z","dependencies_parsed_at":"2022-08-21T01:20:55.383Z","dependency_job_id":null,"html_url":"https://github.com/wendy0402/simple_csv_creator","commit_stats":null,"previous_names":["wendy0402/csv_creator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wendy0402/simple_csv_creator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendy0402%2Fsimple_csv_creator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendy0402%2Fsimple_csv_creator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendy0402%2Fsimple_csv_creator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendy0402%2Fsimple_csv_creator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wendy0402","download_url":"https://codeload.github.com/wendy0402/simple_csv_creator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendy0402%2Fsimple_csv_creator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33568857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["activeadmin-csv","csv","dsl","generator","ruby"],"created_at":"2024-11-15T16:39:39.252Z","updated_at":"2026-05-27T13:37:54.003Z","avatar_url":"https://github.com/wendy0402.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleCsvCreator\n\nSimpleCsvCreator has DSL to build the csv. It's inspired by activeadmin csv\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'simple_csv_creator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install csv_creator\n\n## Usage\n\nSimpleCsvCreator has DSL to build the csv\nit's inspired by activeadmin csv\nexample:\n\n```ruby\nclass User\n  attr_reader :name, :age, :gender\n  def initialize(name, age, gender)\n    @name = name\n    @age = age\n    @gender = gender\n  end\nend\n\nuser1 = User.new('test', 20, 'female')\nuser2 = User.new('mobile', 13, 'male')\ncsv_creator = SimpleCsvCreator.schema do\n  column(:name) # if without block then it will run the name given(user.name), header name will be titleize of name\n  column(:age) { |r| r.age + ' years' } # if with block will run the block\n  column('User Gender') { |r| r.gender } # if want to use custom title need to give the block\nend\nresult = SimpleCsvCreator.simple_generate([user1, user2])\ncsv_parse = CSV.parse(result)\ncsv_parse:\n[\n  ['Name', 'Age', 'User Gender'],\n  ['test', '20 years', 'female'],\n  ['mobile', '13 years', 'male']\n]\n```\n\nSometimes you want to do lazy fetch e.g: `find_each` method in ActiveRecord.\nIf you use simple_generate you won't be able to use this kind of method because simple_generate\nneed the array with all of its elements. To handle it you can use `generate_using` method\n\ne.g:\n```ruby\ngenerator = Proc.new do |\u0026block|\n  resources.each do |resource|\n    block.call(resource)\n  end\nend\nresult = SimpleCsvCreator.generate_using(generator)\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also 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`, which will 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\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/csv_creator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendy0402%2Fsimple_csv_creator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwendy0402%2Fsimple_csv_creator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendy0402%2Fsimple_csv_creator/lists"}