mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-29 12:00:32 +00:00
Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
30
tooling/dast_variables/docs/renderer.rb
Normal file
30
tooling/dast_variables/docs/renderer.rb
Normal file
@ -0,0 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'helper'
|
||||
|
||||
module Tooling
|
||||
module DastVariables
|
||||
module Docs
|
||||
class Renderer
|
||||
include Tooling::DastVariables::Docs::Helper
|
||||
|
||||
attr_reader :schema
|
||||
|
||||
def initialize(output_file:, template:)
|
||||
@output_file = output_file
|
||||
@template = template
|
||||
@layout = Haml::Engine.new(File.read(template))
|
||||
end
|
||||
|
||||
def contents
|
||||
# Render and remove an extra trailing new line
|
||||
@contents ||= @layout.render(self).sub!(/\n(?=\Z)/, '')
|
||||
end
|
||||
|
||||
def write
|
||||
File.write(@output_file, contents)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user