Module: Telegram::Bot::Types::Compactable
- Included in:
- Base
- Defined in:
- lib/telegram/bot/types/compactable.rb
Instance Method Summary collapse
Instance Method Details
#to_compact_hash ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/telegram/bot/types/compactable.rb', line 7 def to_compact_hash attributes.dup.compact.to_h do |key, value| value = value.to_compact_hash if value.respond_to?(:to_compact_hash) [key, value] end end |
#to_json(*args) ⇒ Object
15 16 17 |
# File 'lib/telegram/bot/types/compactable.rb', line 15 def to_json(*args) to_compact_hash.select { |_, v| v }.to_json(*args) end |