Sha256: e581d0552e9fd9cb07e8392eb4f8cf0bbdce05042181c5c6d5a42a22d4a221b6
Contents?: true
Size: 767 Bytes
Versions: 14
Compression:
Stored size: 767 Bytes
Contents
module PyCall Dict = builtins.dict class Dict register_python_type_mapping include Enumerable def self.new(h) super(h, {}) end def length PyCall.len(self) end def has_key?(key) LibPython::Helpers.dict_contains(__pyptr__, key) end alias include? has_key? alias key? has_key? alias member? has_key? def [](key) super rescue PyError nil end def delete(key) v = self[key] LibPython::Helpers.delitem(__pyptr__, key) v end def each return enum_for unless block_given? LibPython::Helpers.dict_each(__pyptr__, &proc) self end def to_h inject({}) do |h, (k, v)| h.update(k => v) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems