Skip to content

Instantly share code, notes, and snippets.

@enebo
Created November 8, 2022 17:22
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