Fast Faker == Faker refactored. rubygems.org/gems/ffaker
A port of Perl’s Data::Faker library that generates fake data. rubygems.org/gems/faker
require 'ffaker' Faker::Name.name => "Christophe Bartell" Faker::Internet.email => "[email protected]"
Faker and Ffaker APIs are mostly the same, although the API on ffaker keeps growing with its users additions. In general, the only difference is that you need to:
gem install ffaker
and then
require 'ffaker'
instead of “faker” with only one f.
Ffaker was initially written in an effort to speed up a slow spec suite. Bear in mind, if your spec suite is slow, chances are the generation of random data will not account for much of the run time.
Since then, the original faker gem has become faster (at the moment it did not seem it was mantained). Nevertheless, ffaker is still about 20x faster than faker.
$ 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 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03
generating 10000 names (faker 0.9.5) 1.500000 0.000000 1.500000 ( 1.506865) generating 10000 names (ffaker 1.5.0) 0.070000 0.000000 0.070000 ( 0.067526)
-
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
generating 10000 names (faker 0.9.5) 1.030000 0.020000 1.050000 ( 1.046116) generating 10000 names (ffaker 1.7.0) 0.040000 0.000000 0.040000 ( 0.045917)
-
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)
-
Chris Bloom (github.com/chrisbloom7)
-
SENE (github.com/PapePathe)
-
kichiro (github.com/kichiro)
-
doctorbh (github.com/doctorbh)
-
1.10.1
Added Faker::AddressCA (Thanks doctorbh, github.com/EmmanuelOga/ffaker/pull/27)
-
1.9.1
Added Faker::NameSN, Faker::PhoneNumberSN (Thanks SENE, github.com/EmmanuelOga/ffaker/pull/26) Added Faker::NameJA (Thanks kichiro, github.com/EmmanuelOga/ffaker/pull/21)
-
1.8.1
Remove a warning.
-
1.8.0
Added Faker::HTMLIpsum module inspired in html-ipsum.com/ (Thanks Chris Bloom, github.com/EmmanuelOga/ffaker/pull/18)
-
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