Sha256: a097345ea81ea68f71f3bf5c955f905c1b652c30ecf1a533207970816b956c89

Contents?: true

Size: 451 Bytes

Versions: 13

Compression:

Stored size: 451 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 =
              if value.class.ancestors.include?(Telegram::Bot::Types::Base)
                value.to_compact_hash
              else
                value
              end

            [key, value]
          end]
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
telegram-bot-ruby-0.15.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.14.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.13.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.12.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.11.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.10.1 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.10.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.9.1 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.9.0 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.8.6.1 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.8.6 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.8.5 lib/telegram/bot/types/compactable.rb
telegram-bot-ruby-0.8.4 lib/telegram/bot/types/compactable.rb