Setsy alternatives and similar gems
Based on the "Abstraction" category.
Alternatively, view Setsy alternatives based on common mentions on social networks and blogs.
-
Interactor
Interactor provides a common interface for performing complex user interactions. -
wisper
A micro library providing Ruby objects with Publish-Subscribe capabilities -
ActiveInteraction
:briefcase: Manage application specific business logic. -
Decent Exposure
A helper for creating declarative interfaces in controllers -
Rails Event Store
A Ruby implementation of an Event Store based on Active Record -
Mutations
Compose your business logic into commands that sanitize and validate input. -
dry-types
Flexible type system for Ruby with coercions and constraints -
Amoeba
A ruby gem to allow the copying of ActiveRecord objects and their associated children, configurable with a DSL on the model -
Inline SVG
Embed SVG documents in your Rails views and style them with CSS -
SimpleCommand
A simple, standardized way to build and use Service Objects (aka Commands) in Ruby -
Waterfall
A slice of functional programming to chain ruby services and blocks, thus providing a new approach to flow control. Make them flow! -
u-service
Represent use cases in a simple and powerful way while writing modular, expressive and sequentially logical code. -
Surrounded
Create encapsulated systems of objects and focus on their interactions -
PageletRails
Improve perceived performance of your rails application with minimum effort -
Smart Init - Simple service objects in Ruby
A simple gem for eliminating Ruby initializers boilerplate code, and providing unified service objects API -
SuperModule
SuperModule allows defining class methods and method invocations the same way a super class does without using def included(base). This also succeeds ActiveSupport::Concern by offering lighter syntax -
skinny_controllers
A pattern for allowing for easier testing of large projects' business logic -
Invokable
Objects are functions! Treat any Object or Class as a Proc (like Enumerable but for Procs). -
EasilyTypable
Ruby module that facilitates English-like type checking in an inheritance hierarchy via "type_name?" methods -
grpc_serializer
A simple library to encode nested hash to grpc object and vice versa -
simple_active_link_to
Simple rails view helper to manage "active" state of a link -
dry-rb
dry-rb is a collection of next-generation Ruby libraries, each intended to encapsulate a common task.
Collect and Analyze Billions of Data Points in Real Time
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Setsy or a related project?
README
Setsy
Settings for your classes. Depends on ActiveModel 3.0+.
Obligatory blog post
Here.
Note
This is not very tidy as it is. But it's battle-tested.
You want this if...
You want this if you don't want to have a zillion columns per model to manage your settings.
Installation
Add this line to your application's Gemfile:
gem 'setsy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install setsy
Usage
First, create a migration for a JSONB column. Call it settings_data
, or something. Just don't call it settings
if you want to be able to call settings
on an instance. Default of {}
In app/models/user.rb
:
class User < ApplicationRecord
include ::Setsy::DSL
# each setting can be a hash, like posts_limit, or just
DEFAULT_SETTINGS = {
posts_limit: { value: 10 },
favorite_color: 'blue'
}.freeze
# do some stuff.
# setsy <attribute_name>, <options>, <block of readers>
setsy :settings, column: :settings_data, defaults: DEFAULT_SETTINGS do |conf|
conf.reader :posts_limit_and_color do
"posts limit is #{posts_limit} and color is #{favorite_color}"
end
end
end
These attributes will become available on User#settings
, and will be backed by the settings_data
column which you created as a JSONB column.
Then in your controller or view or something,
<% @user = User.first %>
<% if @user.settings.posts_limit.default? %>
Posts limit is default.
<% else %>
Posts limit is <%= @user.settings.posts_limit %>
<% end %>
<%= @user.settings.posts_limit_and_color %>
Testing
See spec
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/joshmn/setsy.