Sha256: f56512ed2f1e4576707c27e3d1fb3c384771e588b7b13772d19c6d0994edcad1
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true # :nocov: module Yattho module YARD # Shared functionality for generating documentation from YARD comments. class Backend include DocsHelper private def pretty_default_value(tag, component) params = tag.object.parameters.find { |param| [tag.name.to_s, "#{tag.name}:"].include?(param[0]) } default = tag.defaults&.first || params&.second return "N/A" unless default constant_name = "#{component.name}::#{default}" constant_value = default.safe_constantize || constant_name.safe_constantize return pretty_value(default) if constant_value.nil? pretty_value(constant_value) end def view_context @view_context ||= begin # Rails controller for rendering arbitrary ERB vc = ApplicationController.new.tap { |c| c.request = ActionDispatch::TestRequest.create }.view_context vc.singleton_class.include(DocsHelper) vc.singleton_class.include(Yattho::ViewHelper) vc end end end end end # :nocov:
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yattho_view_components-0.1.1 | lib/yattho/yard/backend.rb |
yattho_view_components-0.0.1 | lib/yattho/yard/backend.rb |