Skip to content

Instantly share code, notes, and snippets.

@perryqh
Created April 2, 2019 16:30
Show Gist options
  • Save perryqh/f2cb371d67434905dbefcc349708c597 to your computer and use it in GitHub Desktop.
Save perryqh/f2cb371d67434905dbefcc349708c597 to your computer and use it in GitHub Desktop.
pseudo code for client urn settings
class StringIsWidgetSetting < String
attr_reader :widget
def initialize(field, widget)
super(widget.send(field))
@widget = widget
end
def method_missing(method_name, *args, &block)
widget.method_missing(method_name, args, block)
end
end
# in Widget
def client_urn
@client_urn ||= StringIsWidgetSetting.new(:client_urn, self)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment