Class: BugReportsClient::DescriptionBuilder
- Inherits:
-
Object
- Object
- BugReportsClient::DescriptionBuilder
- Defined in:
- app/services/bug_reports_client/description_builder.rb
Overview
Builds the markdown description sent to the API (and so the GitHub issue body) from a report's schema-driven answers.
Two modes:
- Template: if the host provides a markdown issue template (explicit
config.issue_template_path or config/bug_report_issue.md), it is
rendered with {{placeholder}} substitution. Available placeholders:
every schema field key, plus {{title}}, {{report_type}}, {{severity}},
{{reporter_name}}, {{app_name}} and {{screenshots}}.
- Default: auto-generates a "## <field label>" section per answered
field in schema order, prefixed with the severity line for bugs and
suffixed with screenshot links.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(bug_report, config: BugReportsClient.config, schema: BugReportsClient.form_schema) ⇒ DescriptionBuilder
constructor
A new instance of DescriptionBuilder.
Constructor Details
#initialize(bug_report, config: BugReportsClient.config, schema: BugReportsClient.form_schema) ⇒ DescriptionBuilder
Returns a new instance of DescriptionBuilder.
15 16 17 18 19 |
# File 'app/services/bug_reports_client/description_builder.rb', line 15 def initialize(bug_report, config: BugReportsClient.config, schema: BugReportsClient.form_schema) @bug_report = bug_report @config = config @schema = schema end |
Instance Method Details
#build ⇒ Object
21 22 23 24 |
# File 'app/services/bug_reports_client/description_builder.rb', line 21 def build template_path = resolve_template_path template_path ? render_template(template_path) : render_default end |