-
-
Save havenwood/aa1204fa18943ae8dbb204e47cab6785 to your computer and use it in GitHub Desktop.
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 IIS | |
class Website | |
def initialize(iis) | |
@shell = iis.shell | |
end | |
end | |
class Mailbox | |
end | |
module Chaining | |
ATTRIBUTES = {website: :Website, | |
mailbox: :Mailbox}.freeze | |
ATTRIBUTES.each do |name, const| | |
define_method name do | |
instance_variable_set "@#{name}", IIS.const_get(const).new(self) | |
end | |
end | |
end | |
include Chaining | |
attr_reader :shell | |
def initialize(shell:) | |
@shell = shell | |
end | |
end | |
IIS.new(shell: '🦪').website |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment