Project

ruzai

0.0
No commit activity in last 3 years
No release in over 3 years
You can suspend user's account for a while and automatically release it after a period.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
>= 0

Runtime

 Project Readme

Ruzai

Build Status

Installation

Add this line to your application's Gemfile:

gem 'ruzai'

And then execute:

$ bundle

Or install it yourself as:

$ gem install user_ban

Usage

Migrate your model which manages user's suspention

bundle exec rake ruzai:install {your model name} (Default value is 'User')

and run bundle exec rake db:migrate

so, you can get "suspended_count" and "suspention_expired_at" for the model.

Include Ruzai for your model.

If your model name is "User", write below.

class User < ActiveRecord::Base
  include Ruzai
  # your codes...
end

Suspend user's account.

  • Ruzai#suspend!

You can suspend user's account for a while. (Default value is 2 weeks, and you can configure it.) In addition, when user gets suspended a certain number of times, user's suspention is not released.(Default value is 5)

  • Ruzai#suspended?

You can check a user is suspended or not.

  • Ruzai#suspended_until

You can get a remain duration until user's suspention is released.

  • Ruzai#ban!

You can ban a terrible user eternally.

Configuring

You can set suspention duration and suspention limit.

suspention_duration is duration of suspention. respawn_limit is max number which user can released from their suspention.

Please create config/initializes/ruzai.rb and write like this.

Ruzai.configure do |config|
  config.suspention_duration = 5.days
  config.respawn_limit = 3

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake rspec 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/[USERNAME]/user_ban. 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.