Sha256: a463ef96e6a5aadcc382eebf157d1246b7c215330eb48255d5c4ea1e6ddf18fb
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
module AssOle module Snippets # module Shared # @api private def self.mapped_mixin(module_) module_.instance_eval do define_method :_hash_to_object do |hash_, object_| hash_.each_with_object(object_) do |k_v, obj| key = (k_v[0].is_a?(Symbol) ? k_v[0].to_s : k_v[0]) value = k_v[1] if value.nil? obj.Insert(key) else obj.Insert(key, value) end end end private :_hash_to_object end end # Snippet for worcking with 1C Map obect module Map is_ole_snippet Shared.mapped_mixin self # Returns new Map builded from hash # @note If +key.is_a? Symbol+ key will be converts to +String+ # @return [WIN32OLE] def map(hash_ = nil, **hash__) hash_ = hash__ if hash_.nil? _hash_to_object(hash_, newObject('Map')) end end # Snippet for worcking with 1C Structure obect module Structure is_ole_snippet Shared.mapped_mixin self # Returns new Structure builded from hash # @note (see Map#map) # @return [WIN32OLE] def structure(hash_ = nil, **hash__) hash_ = hash__ if hash_.nil? _hash_to_object(hash_, newObject('Structure')) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ass_ole-snippets-shared-0.5.0 | lib/ass_ole/snippets/shared/mapped.rb |