class Apipie::Generator::Swagger::PathDecorator
Public Instance Methods
Source
# File lib/apipie/generator/swagger/path_decorator.rb, line 7 def param?(param_name) param_names.include?(param_name) end
@param [Symbol] param_name
Source
# File lib/apipie/generator/swagger/path_decorator.rb, line 2 def param_names @param_names ||= scan(/:(\w+)/).map { |ar| ar[0].to_sym } end
Source
# File lib/apipie/generator/swagger/path_decorator.rb, line 14 def swagger_path(controller_method = nil) current_path = gsub(/:(\w+)/, '{\1}').gsub(%r{/$}, '') unless current_path.starts_with?('/') warn_for_missing_slash(controller_method) if controller_method.present? current_path = "/#{current_path}" end current_path end
@param [String] controller_method
@return [Apipie::Generator::Swagger::PathDecorator]
Private Instance Methods
Source
# File lib/apipie/generator/swagger/path_decorator.rb, line 29 def warn_for_missing_slash(controller_method) Apipie::Generator::Swagger::Warning.for_code( Apipie::Generator::Swagger::Warning::ADDED_MISSING_SLASH_CODE, controller_method, { path: self } ).warn_through_writer end
@param [String] controller_method