Sha256: 15278d5017c28a40eb8e57284402ff074217448aed8b3103424e2abae6890aff

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 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

require 'telegram/bot/types/version'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telegram-bot-types-0.7.0 lib/telegram/bot/types.rb
telegram-bot-types-0.6.3 lib/telegram/bot/types.rb