# 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'
PAGE NO LONGER MAINTAINED, all articles were moved to http://www.eq8.eu/tils where I'll continue adding more ! This page contains simple small Ruby on Rails and web-development hints that are too small for a real blog. You can visit my real blog at http://www.eq8.eu
# 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'