Sha256: c250fe6ba8d66716839f0422c0dd847299e643ae1272d74a6883aa3148ab636a

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module Doraemon

  class APIManager

    def initialize(root = Dir.pwd)
      @root = root
    end

    def load_api

      accept_exts = [".rb", ".json", ".api"]

      api_list = {}

      Dir.foreach(@root) do |filename|
        next if !accept_exts.include? File.extname(filename).downcase
        api_name = "/#{File.basename(filename, '.*')}".tr('_', '/')
        api_name = api_name.gsub('//', '_')
        api_list[api_name] = filename
        puts "#{api_name}  =>  #{filename}"
      end

      return api_list

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doraemon-1.0.6 lib/doraemon/api_manager.rb