{"id":20290308,"url":"https://github.com/ksss/active_tsv","last_synced_at":"2026-03-10T06:03:26.007Z","repository":{"id":62552939,"uuid":"57215904","full_name":"ksss/active_tsv","owner":"ksss","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-06T08:15:39.000Z","size":112,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-19T23:42:53.985Z","etag":null,"topics":["csv","ruby","tsv"],"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/ksss.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":"2016-04-27T13:34:56.000Z","updated_at":"2018-08-15T11:32:01.000Z","dependencies_parsed_at":"2022-11-03T04:15:18.998Z","dependency_job_id":null,"html_url":"https://github.com/ksss/active_tsv","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ksss/active_tsv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Factive_tsv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Factive_tsv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Factive_tsv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Factive_tsv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksss","download_url":"https://codeload.github.com/ksss/active_tsv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Factive_tsv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["csv","ruby","tsv"],"created_at":"2024-11-14T15:06:56.580Z","updated_at":"2026-03-10T06:03:25.984Z","avatar_url":"https://github.com/ksss.png","language":"Ruby","readme":"# ActiveTsv\n\n[![Build Status](https://travis-ci.org/ksss/active_tsv.svg?branch=master)](https://travis-ci.org/ksss/active_tsv)\n\nA Class of Active record pattern for TSV/CSV\n\n## Usage\n\ndata/users.tsv\n\n```tsv\nid\tname\tage\n1\tksss\t30\n2\tfoo\t29\n3\tbar\t30\n```\n\ndata/nicknames.tsv\n\n```tsv\nid\tuser_id\tnickname\n1\t1\tyuki\n2\t1\tkuri\n3\t1\tk\n4\t2\tf\n```\n\n```ruby\nrequire 'active_tsv'\n\nclass User \u003c ActiveTsv::Base\n  self.table_path = \"data/users.tsv\"    # required\n  # self.encoding = Encoding::Shift_JIS # optional\n  # self.primary_key = \"uid\"            # optional\n  has_many :nicknames\nend\n\nclass Nickname \u003c ActiveTsv::Base\n  self.table_path = \"data/nicknames.tsv\"\n  belongs_to :user\nend\n\nUser.all\n=\u003e #\u003cActiveTsv::Relation [#\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e, #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e, #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e]\u003e\nUser.all.to_a\n=\u003e [#\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e, #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e, #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e]\n\nUser.first\n#=\u003e #\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e\nUser.last\n#=\u003e #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e\n\nUser.where(age: 30).each do |user|\n  user.name #=\u003e \"ksss\", \"bar\"\nend\n\nUser.where(age: 30).to_a\n#=\u003e [#\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e, #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e]\n\nUser.where(age: 30).last\n#=\u003e #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e\n\nUser.where(age: 30).where(name: \"ksss\").first\n#=\u003e #\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e\n\nUser.where(id: [1, 2]).to_a\n#=\u003e [#\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e, #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e]\n\nUser.where.not(name: \"ksss\").first\n#=\u003e #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e\n\nUser.group(:age).count\n#=\u003e {\"30\"=\u003e2, \"29\"=\u003e1}\n\nUser.order(:name).to_a\n#=\u003e [#\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e, #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e, #\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e]\n\nUser.order(name: :desc).to_a\n=\u003e [#\u003cUser id: \"1\", name: \"ksss\", age: \"30\"\u003e, #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e, #\u003cUser id: \"3\", name: \"bar\", age: \"30\"\u003e]\n\nUser.first.nicknames\n#=\u003e #\u003cActiveTsv::Relation [#\u003cNickname id: \"1\", user_id: \"1\", nickname: \"yuki\"\u003e, #\u003cNickname id: \"2\", user_id: \"1\", nickname: \"kuri\"\u003e, #\u003cNickname id: \"3\", user_id: \"1\", nickname: \"k\"\u003e]\u003e\n\nNickname.last.user\n#=\u003e #\u003cUser id: \"2\", name: \"foo\", age: \"29\"\u003e\n```\n\nAlso Supported **CSV**.\n\n```ruby\nrequire 'active_csv'\nclass User \u003c ActiveCsv::Base\n  self.table_path = \"data/users.csv\"\nend\n```\n\n## Goal\n\nSupport all methods of ActiveRecord\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'active_tsv'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install active_tsv\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksss%2Factive_tsv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksss%2Factive_tsv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksss%2Factive_tsv/lists"}