Sha256: e25ebcf7397721e30f647f32153104463d3b363ff6c9df730a9054970bbbe629

Contents?: true

Size: 461 Bytes

Versions: 3

Compression:

Stored size: 461 Bytes

Contents

require 'telegram/params/shared/user_component'

module Telegram
  module Params
    class From < UserComponent
      def initialize(params)
        message = params.require(:message)
        @params = message[:from]
        # If from exist then return nil 
        return nil if @params.blank?
          
        from_params = message.require(:from)
        super(from_params)
      end

      def nil?
        super || @params.nil?
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tg-bot-0.0.5 lib/telegram/params/from.rb
tg-bot-0.0.4 lib/telegram/params/from.rb
tg-bot-0.0.3 lib/telegram/params/from.rb