-
-
Save enebo/5d75a524499c24a647c0643a33dbe431 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
require 'java' | |
class WrappedHash < Hash | |
def initialize(value) | |
@value = value | |
end | |
def [](key) | |
@value[key] | |
end | |
end | |
class Java::java::util::HashMap | |
def to_hash | |
WrappedHash.new(self) | |
end | |
end | |
h = java.util.HashMap.new | |
h["one"] = 2 | |
def foo(one:) | |
p one | |
end | |
foo(**h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment