Sha256: e29b079e743a85d331bcce5c58c3107039ebc914a3f931e39aa340a65f977e76

Contents?: true

Size: 698 Bytes

Versions: 13

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true
# author: Vadim Shaveiko <@vshaveyko>
# :nodoc:
class RailsApiDoc::Controller::Parameter::Repository

  @repo = Hash.new { |hsh, key| hsh[key] = Hash.new { |hsh, key| hsh[key] = Param.new(key) } }

  class << self

    def method_missing(name, *args, &block)
      return @repo.send(name, *args, &block) if respond_to_missing?(name)
      super
    end

    def registered_controllers
      @repo.keys
    end

    def respond_to_missing?(method, *)
      @repo.respond_to?(method)
    end

    def []=(key, value)
      unless key < ActionController::Base
        raise ArgumentError, 'Repository keys are controllers only'
      end

      super
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rails_api_documentation-0.2.2 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.2.1 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.2.0 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.9 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.8 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.7 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.6 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.5 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.4 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.3 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.2 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.1 lib/rails_api_doc/controller/parameter/repository.rb
rails_api_documentation-0.1.0 lib/rails_api_doc/controller/parameter/repository.rb