class SwaggerYard::Handlers::DSLHandler

Public Class Methods

method_options() click to toggle source
# File lib/swagger_yard/handlers.rb, line 6
def self.method_options
  @method_options ||= {}
end
register_dsl_method(name, options = {}) click to toggle source
# File lib/swagger_yard/handlers.rb, line 18
def self.register_dsl_method(name, options = {})
  return if self.method_options[name.to_s]
  options[:args] ||= 0..-1
  self.method_options[name.to_s] = options
  handles method_call(name)
end
reset() click to toggle source
# File lib/swagger_yard/handlers.rb, line 10
def self.reset
  method_options.keys.each do |m|
    handler = handlers.detect { |h| h.respond_to?(:name) && h.send(:name).to_s == m.to_s }
    handlers.delete handler if handler
  end
  method_options.clear
end

Public Instance Methods

process() click to toggle source
# File lib/swagger_yard/handlers.rb, line 25
def process
  options = self.class.method_options[caller_method]
  return unless options
  call_params[options[:args]].each do |method_name|
    object = MethodObject.new(namespace, method_name, scope)
    object.signature = "def #{method_name}"
    register(object)
  end
end