module YARD::Templates::Helpers::BaseHelper

Public Instance Methods

api_options() click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 4
def api_options()
  YARD::APIPlugin.options
end
get_current_route() click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 39
def get_current_route
  get_current_routes.first
end
get_current_routes() click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 35
def get_current_routes
  YARD::Templates::Helpers::RouteHelper.routes_for_yard_object(object)
end
logger() click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 47
def logger
  YARD::APIPlugin.logger
end
lookup_appendix(title) click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 8
def lookup_appendix(title)
  appendix = nil

  logger.debug("Looking up appendix: #{title}")

  if object
    # try in the object scope
    appendix = YARD::Registry.at(".appendix.#{object.path}.#{title}")

    # try in the object's namespace scope
    if appendix.nil? && object.respond_to?(:namespace)
      appendix = YARD::Registry.at(".appendix.#{object.namespace.path}.#{title}")
    end
  end

  appendix
end
schema_is_model?(schema) click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 43
def schema_is_model?(schema)
  schema.has_key?('description') && schema.has_key?('properties')
end
tag_partial(name, tag, locals={}) click to toggle source
# File lib/yard-api/templates/helpers/base_helper.rb, line 26
def tag_partial(name, tag, locals={})
  options[:tag] = tag
  locals.each_pair { |key, value| options[key] = value }
  out = erb(name)
  options.delete(:tag)
  locals.keys.each { |key| options.delete(key.to_sym) }
  out
end