Sha256: 57ca288b7f74fbb50b38fce10db85058f232cdb3348d0d22bfe7fc45fa1217f1

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

require 'yard/templates/helpers/base_helper'

module YARD::Templates::Helpers::BaseHelper
  def api_options()
    YARD::APIPlugin.options
  end

  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

  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

  def get_current_routes
    YARD::Templates::Helpers::RouteHelper.routes_for_yard_object(object)
  end

  def get_current_route
    get_current_routes.first
  end

  def schema_is_model?(schema)
    schema.has_key?('description') && schema.has_key?('properties')
  end

  def logger
    YARD::APIPlugin.logger
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
yard-api-1.1.2 lib/yard-api/templates/helpers/base_helper.rb
yard-api-1.1.1 lib/yard-api/templates/helpers/base_helper.rb
yard-api-1.1.0 lib/yard-api/templates/helpers/base_helper.rb
yard-api-1.0.1 lib/yard-api/templates/helpers/base_helper.rb
yard-api-1.0.0 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.7 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.6 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.5 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.4 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.3 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.2 lib/yard-api/templates/helpers/base_helper.rb
yard-api-0.3.1 lib/yard-api/templates/helpers/base_helper.rb