Sha256: e2e514a55520d75ed9cca379eb1720178f57dbea90fc945fe0140c41527b5cb3

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

require 'pathname'

module Telegram
  module Bot
    module Types
      module_function

      # Simple implementation for internal use only.
      # rubocop:disable all
      def camelize(str)
        str.gsub(/(?:_|(\/)|^)([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
      end
      # rubocop:enable all

      files = Pathname(__FILE__).dirname.join('types').children.map { |x| x.basename.to_s }
      types = files.select { |x| x.end_with?('.rb') }.map { |x| x.gsub(/\.rb$/, '') }
      types -= ['version']
      types.each do |type|
        autoload camelize(type), "telegram/bot/types/#{type}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
telegram-bot-types-0.6.2 lib/telegram/bot/types.rb