Skip to content

davydovanton/stop_active_support_anywhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stop ActiveSupport Anywhere

Goal

We love ruby and ruby community. We can find excellent web (and not only web) frameworks like rails, hanami, grape, sinatra, dry-wb, roda, etc. But sometimes some developers use rails dependency in gems which not related to use only with rails. That's why the main idea of this repo is to collect all libraries which you can use instead using ActiveSupport

Some Problems with ActiveSupport

ActiveSupport is a "toolkit of support libraries and Ruby core extensions extracted from the Rails framework". Core extensions is a prettier name for monkey-patches of Ruby core classes. Monkey-patching breaks fundamental contracts with the language core - with deadly consequences.

Monkey-patching hinders interoperability. Any piece of Ruby software is written to work either in the monkey-patch-free environment, or in the monkey-patched one. Sure: with a bit of luck, many work in both. But won't your gem break with the next release of ActiveRecord (which it itself doesn't rely on at all)? Noone can say in advance.

When it is Permissible to Depend on ActiveSupport?

"You are definitely allowed to shoot yourself in the foot, if you really want to." It is only responsible to rely on ActiveSupport (or another similar ton of monkey-patches) if you are in position of the "lord of the stack", i.e., if you are developing an application, and you are the only one who decides forever, which components will interoperate. Libraries, aiming to be general tools, maximally interoperable with others, as well as applications open to extensions, must never pollute the runtime environment by monkey-patching.

Blog Posts

TODO

  1. collect all gems or solutions which can replace some parts of AS (current status)
  2. filter all this information
  3. create list of not only rails gems which use AS and try to fix it

Table of contents

Features

date formatters

ActiveSupport::ArrayInquirer

Link to rails docs

Alternatives

# instead of:
[:blue, :green].blue?

# do this:
[:blue, :green].include?(:blue)

ActiveSupport::BacktraceCleaner

Link to rails docs

Alternatives

  1. gem: Morozzzko/backtrace_cleaner link

ActiveSupport::Callbacks

Link to rails docs

Alternatives

  1. gem: delner/hollerback link
  2. gem: PragTob/after_do link
  3. sources: RSpec::Core::Hooks link

ActiveSupport::Configurable

Link to rails docs

Alternatives

  1. gem: dry-configurable link
  2. gem: markevans/configurable link
  3. gem: ged/configurability link
  4. post: Ruby Gem Configuration Patterns link
  5. post: MyGem.configure Block link

ActiveSupport::Concurrency

Link to rails docs

Alternatives

  1. ruby-concurrency link

ActiveSupport::Deprecation

Link to rails docs

Alternatives

  1. core library: Gem::Deprecate link
  2. gem: Hanami::Deprecation link
  3. gem: erikh/deprecated link
  4. gem: cbeer/deprecation link

ActiveSupport::Duration

Link to rails docs

Alternatives

  1. gem: zverok/time_math2 link
  2. gem: zverok/time_calc link
  3. gem: janko-m/as-duration link

ActiveSupport::Gzip

Link to rails docs

Alternatives

  1. core library: zlib link
  2. SO question: How to decompress Gzip string in ruby? link

ActiveSupport::HashWithIndifferentAccess

Link to rails docs

Alternatives

  1. core library: OpenStruct link

ActiveSupport::Inflector

Link to rails docs

Alternatives

  1. gem: linguistics link
  2. gem: dry-inflector link

ActiveSupport::LazyLoadHooks

Link to rails docs

Alternatives

none

ActiveSupport::Notifications

Link to rails docs

Alternatives

  1. gem: dry-monitor link
  2. gem: dry-events: link

ActiveSupport::NumberHelper

Link to rails docs

Alternatives

  1. core library: Kernel#sprintf link

ActiveSupport::NumericWithFormat

Link to rails docs

Alternatives

none

ActiveSupport::RangeWithFormat

Link to rails docs

Alternatives

none

ActiveSupport::TimeWithZone

Link to rails docs

Alternatives

  1. gem: et-orbi link
  2. Ruby 2.6 added timezone support to core link

ActiveSupport::CoreExtensions

Integer

Not rails specific gems which use AS as dependency

Contribute

Contributions welcome!

About

Stop use Active Support in not rails related projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages