Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

ffaker

Fast Faker == Faker refactored, cleaner and faster.

Faker

A port of Perl's Data::Faker library that generates fake data.

Usage

require 'ffaker'

Faker::Name.name => "Christophe Bartell"

Faker::Internet.email => "kirsten.greenholt@corkeryfisher.info"

Ffaker / Faker

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.

Faster? does it really matter ?

$ 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!

Contributors

Changelog

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"

TODO

  • Even though the API is pretty simple, better rdoc documentation would not hurt.

Note on Patches/Pull Requests

  • 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

Copyright © 2010 Emmanuel Oga. See LICENSE for details. Copyright © 2007 Benjamin Curtis

Something went wrong with that request. Please try again.