Fast Faker == Faker refactored, cleaner and faster.
A port of Perl’s Data::Faker library that generates fake data.
require 'ffaker' Faker::Name.name => "Christophe Bartell" Faker::Internet.email => "kirsten.greenholt@corkeryfisher.info"
The are only two differences between faker and ffaker. The first one is that you need to
gem install ffaker
and then
require 'ffaker'
instead of “faker” with only one f.
The API is pretty much the same as before.
The second difference is that Faker::VERSION is no longer a module, so instead of accessing the version like this:
Faker::VERSION::STRING # faker
you’ll need to access it like this:
Faker::VERSION # ffaker
Fork it/ping me if you feel like adding more goodies to it.
$ cat scripts/benchmark.rb
# ... N = 10_000 Benchmark.bm do |rep| rep.report("generating #{ N } names") do N.times do Faker::Name.name end end end
-
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2009.10
user system total real Faker 9.240000 0.020000 9.260000 ( 9.297381) Fast Faker 0.060000 0.000000 0.060000 ( 0.109047)
-
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
user system total real Faker 74.980000 0.110000 75.090000 ( 75.881142) Fast Faker 0.050000 0.000000 0.050000 ( 0.052292)
DISCLAIMER: I have no idea why I’m getting such bad numbers for traditional faker on 1.9, but I’m not making this up. Try it in your own machine, your mileage may vary!
-
James Rosen ( github.com/jamesarosen/ffaker ).
-
Rafael Souza ( github.com/rafaelss/ffaker ).
-
Robert Berry ( github.com/bdigital ).
-
qichunren ( github.com/qichunren ).
-
Kristján Pétursson ( github.com/kristjan )
-
Rico Sta. Cruz ( github.com/rstacruz )
-
Vsevolod Romashov ( github.com/7even )
-
David Noelte (github.com/marvin)
-
Port 80 Labs (github.com/port80labs)
-
Shane Weng (github.com/swcool)
-
1.7.0
Added Faker::LoremCN (Thanks Shane Weng, Shane Weng (github.com/swcool), github.com/EmmanuelOga/ffaker/pull/16/files)
-
1.6.0
Added Faker::NameDE (Thanks David Noelte, github.com/marvin, github.com/EmmanuelOga/ffaker/pull/17) Added Faker::Internet#disposable_email (Thanks Port 80 Labs, github.com/port80labs, github.com/EmmanuelOga/ffaker/pull/15)
-
1.5.0
Added Faker::NameRU (Thanks Vsevolod Romashov, github.com/7even, github.com/EmmanuelOga/ffaker/pull/14)
-
1.4.0
Added Faker::Product and Faker::Education ( Thanks Rico Sta. Cruz, github.com/EmmanuelOga/ffaker/pull/12 )
-
1.3.0
Faker::Lorem.word as a convenience method, instead of Faker::Lorem.words(1).first.
-
1.2.0
New Faker::NameCN module (contributions by qichunren)
Faker::NameCN.first_name # => 鑫洋 Faker::NameCN.last_name # => 禹 Faker::NameCN.name # => 俊伶漫
-
1.1.0
Api additions (contributions by Robert Berry)
Faker::Internet.uri(protocol) Faker::Internet.http_url Faker::Internet.ip_v4_address
-
0.4.0
Api additions by Rafael Souza
Faker::Geolocation.lat # => 40.6609944585817 Faker::Geolocation.lng # => -73.8454648940358 Faker::Address.neighborhood # => "Renton West"
-
Even though the API is pretty simple, better rdoc documentation would not hurt.
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright © 2010 Emmanuel Oga. See LICENSE for details. Copyright © 2007 Benjamin Curtis