Sha256: 6e74717ba0a06d9777d7a10cf84e9703d26043e6bbaa1caef28ab115228aef5c
Contents?: true
Size: 652 Bytes
Versions: 2
Compression:
Stored size: 652 Bytes
Contents
module Telegram module Bot module Types module Compactable def to_compact_hash Hash[attributes.dup.delete_if { |_, v| v.nil? }.map do |key, value| value = recursive_hash_conversion(value) [key, value] end] end private def recursive_hash_conversion(value) if value.class.ancestors.include?(Telegram::Bot::Types::Base) value.to_compact_hash elsif value.is_a?(Array) value.map { |arr_content| recursive_hash_conversion(arr_content) } else value end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dialog_bot_ruby-0.8.8 | lib/telegram/bot/types/compactable.rb |
dialog_bot_ruby-0.8.7 | lib/telegram/bot/types/compactable.rb |