Skip to content

Instantly share code, notes, and snippets.

@weskerfoot
Created November 1, 2021 15:07
Show Gist options
  • Save weskerfoot/121e12f2e2352788b54e9b7a2b85b85d to your computer and use it in GitHub Desktop.
Save weskerfoot/121e12f2e2352788b54e9b7a2b85b85d to your computer and use it in GitHub Desktop.
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