Class: MandateClaw::Renderers::MarkdownRenderer
- Inherits:
-
Object
- Object
- MandateClaw::Renderers::MarkdownRenderer
- Defined in:
- lib/mandate_claw/renderers/markdown_renderer.rb
Overview
Renders a contract class as a human-readable Markdown document. This is the “bidirectional transpilation” — the same DSL that the Ruby runtime enforces can be read by lawyers and regulators.
Instance Method Summary collapse
-
#initialize(contract_class) ⇒ MarkdownRenderer
constructor
A new instance of MarkdownRenderer.
- #render ⇒ Object
Constructor Details
#initialize(contract_class) ⇒ MarkdownRenderer
Returns a new instance of MarkdownRenderer.
9 10 11 |
# File 'lib/mandate_claw/renderers/markdown_renderer.rb', line 9 def initialize(contract_class) @c = contract_class end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mandate_claw/renderers/markdown_renderer.rb', line 13 def render sections = [] sections << header sections << parties_section sections << obligations_section if @c._obligations.any? sections << if @c..any? sections << prohibitions_section if @c._prohibitions.any? sections << agent_bounds_section if @c._agent_bounds.any? sections << rules_section if @c._rules.any? sections << attestation_section if @c._attestation sections << sections.compact.join("\n\n") end |