https://github.com/ixti/amazing-activist
Your friendly neighborhood activist.
https://github.com/ixti/amazing-activist
Last synced: about 1 year ago
JSON representation
Your friendly neighborhood activist.
- Host: GitHub
- URL: https://github.com/ixti/amazing-activist
- Owner: ixti
- License: mit
- Created: 2024-01-27T02:28:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-16T00:10:11.000Z (over 1 year ago)
- Last Synced: 2025-03-18T11:11:25.271Z (about 1 year ago)
- Language: Ruby
- Size: 59.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
= AmazingActivist
:ci-url: https://github.com/ixti/amazing-activist/actions/workflows/ci.yml?query=branch%3Amain
:ci-img: https://github.com/ixti/amazing-activist/actions/workflows/ci.yml/badge.svg?branch=main
:codecov-url: https://codecov.io/gh/ixti/amazing-activist/tree/main
:codecov-img: https://codecov.io/gh/ixti/amazing-activist/graph/badge.svg?token=LXaGWwv5xl
ifdef::env-github[]
{ci-url}[image:{ci-img}[CI]]
{codecov-url}[image:{codecov-img}[codecov]]
endif::[]
== Installation
Add this line to your application's Gemfile:
$ bundle add amazing-activist
Or install it yourself as:
$ gem install amazing-activist
== Usage
[source,ruby]
----
class ApplicationActivity < AmazingActivist::Base
end
class OnboardingActivity < ApplicationActivity
def call
user = User.new(params)
return failure(:invalid_params, user: user) unless user.save
success(user)
end
end
class UsersController < ApplicationController
def create
case OnboardingActivity.call(**params.require(:user).permit(:password))
in success: user
redirect_to user_bashboard_url(user)
in failure: :invalid_params, context: { user: user }
@user = user
render :new
else
head :bad_request
end
end
end
----
== Compatibility
This library aims to support and is tested against:
* https://www.ruby-lang.org[Ruby]
** MRI 3.0.x
** MRI 3.1.x
** MRI 3.2.x
** MRI 3.3.x
** MRI 3.4.x
If something doesn't work on one of these versions, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby versions,
however support will only be provided for the versions listed above.
== Development
bundle install
bundle exec rake
== Contributing
* Fork amazing-activist
* Make your changes
* Ensure all tests pass (`bundle exec rake`)
* Send a merge request
* If we like them we'll merge them
* If we've accepted a patch, feel free to ask for commit access!