Use Rails (ActiveSupport) delegation class in plain ruby
Today I've Learned post# Gemfile
source "https://rubygems.org"
gem 'active_support'
require 'active_support/core_ext/module/delegation'
class Foo
delegate :call, to: :other
def other
->(){ 'foo' }
end
end
Foo.new.call
# => 'foo'
source:
Entire blog website and all the articles can be forked from this Github Repo