Ruby Abstraction

Open-source Ruby projects categorized as Abstraction

Top 23 Ruby Abstraction Projects

  • Trailblazer

    The advanced business logic framework for Ruby.

  • Interactor

    Interactor provides a common interface for performing complex user interactions.

    Project mention: How to avoid if/else with different ramifications | reddit.com/r/rails | 2022-07-21

    You might be looking for an interactor pattern for these services. I've used this gem for similar things before and have had good experiences.

  • Zigi

    Close all those tabs. Zigi will handle your updates.. Zigi monitors Jira and GitHub updates, pings you when PRs need approval and lets you take fast actions - all directly from Slack! Plus it reduces cycle time by up to 75%.

  • wisper

    A micro library providing Ruby objects with Publish-Subscribe capabilities

    Project mention: Event Store with Rails | reddit.com/r/rails | 2022-11-15

    I haven't used it, but we're also considering it in our app for quite some time. Our main issue is mostly that our codebase is super coupled, especially some older code, and using events as a means of communication between different modules of the app can be nice way of decoupling things. I think this is the most common usecase, and for this you don't necessarily even need to persist the events, and also something like wisper might be useful https://github.com/krisleech/wisper.

  • Cells

    View components for Ruby and Rails.

    Project mention: The Admin Framework for Minimalist | dev.to | 2022-11-01

    It can be used with Ruby on Rails or other frameworks because I implemented with trailblazer/cells.

  • view_component

    A framework for building reusable, testable & encapsulated view components in Ruby on Rails.

    Project mention: Rails 7 + Hotwire (Turbo + Stimulus) = Modern web applications | dev.to | 2022-11-24

    tl;dr; Let’s understand how we can migrate a scaffold generated by the command ‘bin/rails g scaffold Kit::Product name:string’, to an improved and performative screen. Inserting partial load and DOM manipulation writing a very little code in VanillaJS (“almost” without to write Javascript). Scaffold (Rails 7) Getting Started with Rails (https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails) Generating the scaffold (https://guides.rubyonrails.org/command_line.html#bin-rails-generate): Using just one command you will generate all of these files: Model, Migration, Controllers, Routes, Tests, Helpers, and JSON. $ **bin/rails generate scaffold HighScore game:string score:integer** invoke active_record create db/migrate/20190416145729_create_high_scores.rb create app/models/high_score.rb invoke test_unit create test/models/high_score_test.rb create test/fixtures/high_scores.yml invoke resource_route route resources :high_scores invoke scaffold_controller create app/controllers/high_scores_controller.rb invoke erb create app/views/high_scores create app/views/high_scores/index.html.erb create app/views/high_scores/edit.html.erb create app/views/high_scores/show.html.erb create app/views/high_scores/new.html.erb create app/views/high_scores/_form.html.erb invoke test_unit create test/controllers/high_scores_controller_test.rb create test/system/high_scores_test.rb invoke helper create app/helpers/high_scores_helper.rb invoke test_unit invoke jbuilder create app/views/high_scores/index.json.jbuilder create app/views/high_scores/show.json.jbuilder create app/views/high_scores/_high_score.json.jbuilder Enter fullscreen mode Exit fullscreen mode After installing Rails, create your project, and generate your scaffold. Let's try to improve the default interface. I am using the Tailwind to insert styles on the interfaces and the ViewComponent for “creating reusable, testable & encapsulated view components, built to integrate seamlessly with Ruby on Rails”. You could see the resulting code at https://github.com/raphox/rails-7-fullstack. Turbo (heart of Hotwire) Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire. You can see the unique application’s screen in the following image. Yes, this project has just one screen. Let’s try to be simple to focus on the most important things. In this screen, we have two dynamic areas: List of products Form to create and edit the selected product I created a PR so you can see the exact part of the code that was changed or inserted to use the Hotwire on your project. You can see this PR on https://github.com/raphox/rails-7-fullstack/pull/1. The unique screen on the system has a few triggers to call actions or make requests. Plus button to access the ‘kit/products/new’ page Search input field Products links to access the product’s edit page Buttons to update, remove or create products based on the form’s fields data Using the Turbo, we can override the click event of the plus button to request the HTML of a new product form from the backend and put it in the ‘product_form’ area. You don’t need to write Javascript to override the events on your elements, just insert a new attribute ‘turbo_frame’ on your HTML tag. Like here: We can use the same approach of the plus button in the link of products and prevent reloading the entire screen HTML and assets. Now we need to use a little Javascript to insert the event ‘change’ to request a filtered list of products from the backend. In my code, I insert the ‘turbo_frame’ attribute into the form to change the submit action making the request using Turbo. In the next topic, we can see how to use the Stimulus and Javascript controllers to change the event ‘change’ of the input. Now we will need to submit the form and refresh the list of products. But we can do this better. We know that the updated list has changed on the created/updated product. So, we need to update the list with this product, instead refresh and query all the list of products from the database. To do this we need to use a lot of the Javascript code or a few actions from the Stimulus. You can see about the Javascript controller in the next topic. Stimulus (modest JavaScript framework) You won’t see any difference. But the code savings and ease of integration will help you a lot when inserting new features. The objective here is to insert an event on the search input form to make a request when the user changes the input’s value. When it occurs, the system will make a request to get all products filtered by the ‘name’ column. The result will be inserted into the list after it. To implement the Stimulus in our current project, we need to follow the following steps: 1. Insert the attribute ‘data-controller=”search-list”’ to the wrapper with the form and the list of the products (app/components/search_list_component.html.erb line 1). — This attribute is responsible to relate the following code to the DIV element. Get more info here https://stimulus.hotwired.dev/. — You can use the command ‘./bin/rails generate stimulus controllerName’ to generate the Javascript file with the class definition and import it in the ‘app/javascript/controllers/index.js’ automatically. 2. Insert the attribute ‘data-search_list_target=”inputSearch”’ to the form search field (app/components/search_list_form_component.html.erb line 2). 3. Insert the action (click->search-list#selectItem) to activate the currently selected product (app/components/search_list_item_component.rb lines 20). 4. Insert the attribute ‘search_list_target=”item”’ to each item of the product list (app/components/search_list_item_component.rb lines 21). I am using https://viewcomponent.org/ to define the view components instead to use a view or partial. Pay attention to this part https://viewcomponent.org/#performance. I really liked having this structure in my project: rails-7-fullstack/_list.html.erb at 11a479dafa5c84a1e769721d57792f39914a1204 ·… This approach is very similar to the React components or other Javascript Frameworks. I created a PR where you can see the exact part of the code I changed or inserted to use the Stimulus on my project. You can see this PR on https://github.com/raphox/rails-7-fullstack/pull/2.

  • Responders

    A set of Rails responders to dry up your application

  • ActiveInteraction

    :briefcase: Manage application specific business logic.

    Project mention: Applying the Use Case Pattern with Rails | reddit.com/r/rails | 2022-04-06

    The Interactor and ActiveInteraction gems are both great libraries for implementing this pattern.

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

  • Decent Exposure

    A helper for creating declarative interfaces in controllers

  • Mutations

    Compose your business logic into commands that sanitize and validate input.

    Project mention: Utilizando o padrão interactor no Ruby on Rails | dev.to | 2022-03-20

    View on GitHub

  • Rails Event Store

    A Ruby implementation of an Event Store based on Active Record

    Project mention: Event Store with Rails | reddit.com/r/rails | 2022-11-15

    Does anyone implemented or used a gem such as https://railseventstore.org to support Event Store in their Rails app?

  • dry-types

    Flexible type system for Ruby with coercions and constraints

  • Light Service

    Series of Actions with an emphasis on simplicity.

    Project mention: How to avoid if/else with different ramifications | reddit.com/r/rails | 2022-07-21

    Similar to the above recommendations of Railway Orientated Programming and the Interactor gem, I use the Light Service gem. While it can sometimes be a bit verbose it excels in code reuse, testability, and composition.

  • Amoeba

    A ruby gem to allow the copying of ActiveRecord objects and their associated children, configurable with a DSL on the model

    Project mention: Ways to enable the users of my app to duplicate/copy their records? | reddit.com/r/rails | 2022-11-16
  • Apotomo

    MVC Components for Rails.

  • Waterfall

    A slice of functional programming to chain ruby services and blocks, thus providing a new approach to flow control. Make them flow! (by apneadiving)

    Project mention: Utilizando o padrão interactor no Ruby on Rails | dev.to | 2022-03-20

    View on GitHub

  • SimpleCommand

    A simple, standardized way to build and use Service Objects (aka Commands) in Ruby

    Project mention: Floyd's E-Commerce: from Squarespace to Solidus | dev.to | 2022-06-21

    In 2014, Floyd was lesser known as The Floyd Leg. Our website was on Squarespace for both its e-commerce solution and web hosting. A large part of our current success was realized by choosing to invest in a custom web application that’s built with Solidus. With our website no longer abstracted by a WYSIWYG ("What You See Is What You Get") editor, we partnered with Nebulab to handle full-stack web development. Solidus (Spree, at the time, before it was acquired, forked, and renamed) was recommended to power the e-commerce part of our application. The decision to go custom came after a successful Kickstarter campaign back in 2015 for the Floyd Legs—a set of four steel table legs that fastened onto any flat surface to quickly put a table together. We proved a market need for adaptable and sustainable furniture design. The co-founders, Kyle Hoff and Alex O’Dell, knew there were more product offerings on the roadmap as they championed Floyd to be the furniture solution for all apartment essentials. Fast forward to 2019, Floyd is seeking to be the furniture solution for the entire home worldwide.

  • Rectify

    Build maintainable Rails apps

    Project mention: How do you approach adding server side form validation rules on the fly (user defined forms) | reddit.com/r/rails | 2022-09-21

    I really like Rectify for form objects like this but you can use ActiveModel just fine. Here's Rectify's form object using ActiveModel: https://gist.github.com/Partytray/d74fd2a9d2ffa6da9b3fb9f929382927

  • phlex

    A framework for building object-oriented views in Ruby

    Project mention: I wish Rails was better | reddit.com/r/rails | 2022-11-23

    Take a look into Phlex

  • Sequent

    CQRS & event sourcing framework for Ruby

    Project mention: Event Store with Rails | reddit.com/r/rails | 2022-11-15

    Co-author of the Sequent gem (https://www.sequent.io) here. Can confirm that it’s a great gem to build event sourced applications with (as long as you’re using PostgreSQL). It’s very battle tested as it has been extracted from/used in a web based accounting system that currently holds about 1 billion events in the event store.

  • u-service

    Represent use cases in a simple and powerful way while writing modular, expressive and sequentially logical code.

    Project mention: Should I use service objects? | reddit.com/r/rails | 2022-10-13
  • dry-transaction

    Business transaction DSL

  • Clowne

    A flexible gem for cloning models

  • PageletRails

    Improve perceived performance of your rails application with minimum effort

  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2022-11-24.

Ruby Abstraction related posts

Index

What are some of the best open-source Abstraction projects in Ruby? This list will help you:

Project Stars
1 Trailblazer 3,270
2 Interactor 3,129
3 wisper 3,106
4 Cells 3,027
5 view_component 2,740
6 Responders 1,973
7 ActiveInteraction 1,880
8 Decent Exposure 1,764
9 Mutations 1,373
10 Rails Event Store 1,176
11 dry-types 784
12 Light Service 747
13 Amoeba 736
14 Apotomo 658
15 Waterfall 608
16 SimpleCommand 596
17 Rectify 576
18 phlex 547
19 Sequent 503
20 u-service 469
21 dry-transaction 408
22 Clowne 297
23 PageletRails 249
Build time-series-based applications quickly and at scale.
InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.
www.influxdata.com