class Port
attr_accessor :source, :target
def initialize
@source = Hash.new
@source.instance_variable_set(:@port, self)
@target = Hash.new
def @source.[]=(key, value)
if key == :precision
@port.source[:offset] = 10
end
super
end
end
end
port = Port.new
port.source[:precision] = 10
puts port.source[:precision]
puts port.source[:offset]
Y2xhc3MgUG9ydAogIGF0dHJfYWNjZXNzb3IgOnNvdXJjZSwgOnRhcmdldAogIGRlZiBpbml0aWFsaXplCiAgICBAc291cmNlID0gSGFzaC5uZXcKICAgIEBzb3VyY2UuaW5zdGFuY2VfdmFyaWFibGVfc2V0KDpAcG9ydCwgc2VsZikKICAgIEB0YXJnZXQgPSBIYXNoLm5ldwogICAgZGVmIEBzb3VyY2UuW109KGtleSwgdmFsdWUpCiAgICAgIGlmIGtleSA9PSA6cHJlY2lzaW9uIAogICAgICAgIEBwb3J0LnNvdXJjZVs6b2Zmc2V0XSAgPSAxMAogICAgICBlbmQKICAgICAgc3VwZXIKICAgIGVuZAoKICBlbmQKICAKICAKZW5kCgpwb3J0ID0gUG9ydC5uZXcKcG9ydC5zb3VyY2VbOnByZWNpc2lvbl0gPSAxMAoKcHV0cyBwb3J0LnNvdXJjZVs6cHJlY2lzaW9uXQpwdXRzIHBvcnQuc291cmNlWzpvZmZzZXRd