Created
November 1, 2021 15:07
-
-
Save weskerfoot/121e12f2e2352788b54e9b7a2b85b85d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'forwardable' | |
Foo = Struct.new(:x) do | |
def bar | |
x | |
end | |
end | |
class Bar | |
extend Forwardable | |
def_delegators :@foo, :bar, | |
def initialize | |
@foo = Foo.new(12) | |
end | |
end | |
puts Bar.new.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment