Created
September 18, 2019 18:18
-
-
Save patmaddox/aaf7e7a82fe3057c33fe29f2af1bc6a2 to your computer and use it in GitHub Desktop.
SOLID in Ruby is fluid
This file contains 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
class Foo1 | |
def foo | |
puts "hello foo" | |
end | |
end | |
module FooModule | |
def foo | |
puts "hello foo" | |
end | |
end | |
class Foo2 | |
include FooModule | |
end | |
require 'forwardable' | |
class DoFoo | |
def foo | |
puts "hello foo" | |
end | |
end | |
class Foo3 | |
extend Forwardable | |
def_delegator :@foo, :foo | |
def initialize | |
@foo = DoFoo.new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment