Skip to content
Gem that generates unique phrases to use in your app as password, url, tokens and etc.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rspec
.rubocop.yml
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE.txt
README.md
Rakefile
circle.yml
phraser.gemspec

README.md

Phraser

Phraser is a gem that generates unique phrases to use in your app as password, url and tokens

Installation

Add this line to your application's Gemfile:

gem 'phraser'

And then execute:

$ bundle

Or install it yourself as:

$ gem install phraser

Usage

Full

Phraser.generate(prefix: proc{ Time.now.to_i }, postfix: "the-end")
Phraser.generate_string(separator: '*', prefix: proc{ Time.now.to_i }, postfix: "the-end")

All parameters are optional (just use named arguments):

  • separator is "-" by default but if you would like a different separator, just pass a string
  • prefix String or Proc going to be 1st element in the resulted array or string
  • postfix String or Proc will be last element in the resulted array or string

Examples

Generate array:

Phraser.generate
> ["marked", "purple", "joke", "on", "presence"]

Generate string:

Phraser.generate_string
> 'convinced-brown-hop-at-South"

Different separator, prefix is Timestamp and 'the-end' string added to the end of the string

separator = '*'
prefix = proc{ Time.now.to_i }
postfix = "the-end"
Phraser.generate_string(separator: separator, prefix: prefix, postfix: postfix)
> "1496842603*red*massive*elephant*the-end"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mpakus/phraser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Phraser project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

CircleCI

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.