ActiveTsv
Usage
id name age
1 ksss 30
2 foo 29
3 bar 30
class User < ActiveTsv::Base
self.table_path = "data/users.tsv"
end
User.first #=> #<User {:id=>"1", :name=>"ksss", :age=>"30"}>
User.last #=> #<User {:id=>"3", :name=>"bar", :age=>"30"}>
User.where(age: 30).to_a #=> [#<User {:id=>"1", :name=>"ksss", :age=>"30"}>, #<User {:id=>"3", :name=>"bar", :age=>"30"}>]
User.where(age: 30).last #=> #<User {:id=>"3", :name=>"bar", :age=>"30"}>
User.where(age: 30).where(name: "ksss").first #=> #<User {:id=>"1", :name=>"ksss", :age=>"30"}>
Also Supported CSV.
class User < ActiveCsv::Base
self.table_path = "data/users.csv"
end
Goal
Support all methods that like ActiveRecord
Installation
Add this line to your application's Gemfile:
gem 'active_tsv'
And then execute:
$ bundle
Or install it yourself as:
$ gem install active_tsv
License
The gem is available as open source under the terms of the MIT License.