Sha256: 69615b3bd6dfc417bf4908824aee547e24fa04b2e600571deb5d0b77c20c5ca0
Contents?: true
Size: 1.97 KB
Versions: 5
Compression:
Stored size: 1.97 KB
Contents
module Telegram module Params class ChatComponent attr_reader :id, :type, :title, :username, :first_name, :last_name, :all_members_are_administrators, :photo, :description, :invite_link, :pinned_message, :sticker_set_name, :can_set_sticker_set def initialize(params) return if params.blank? chat_params = chat_params_permit_from(params) @id = chat_params[:id] @type = chat_params[:type] @title = chat_params[:title] @username = chat_params[:username] @first_name = chat_params[:first_name] @last_name = chat_params[:last_name] @all_members_are_administrators = chat_params[:all_members_are_administrators] @photo = chat_params[:photo] @description = chat_params[:description] @invite_link = chat_params[:invite_link] @pinned_message = chat_params[:pinned_message] @sticker_set_name = chat_params[:sticker_set_name] @can_set_sticker_set = chat_params[:can_set_sticker_set] end def nil? self.instance_variables.map{ |attribute| self.instance_variable_get(attribute) } .map(&:nil?) .reduce(:&) end private def chat_params_permit_from(params) params.permit( :id, :type, :title, :username, :first_name, :last_name, :all_members_are_administrators, :photo, :description, :invite_link, :pinned_message, :sticker_set_name, :can_set_sticker_set ) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems