Class: DnsMadeEasy::Zone::PlanRenderer
- Inherits:
-
Object
- Object
- DnsMadeEasy::Zone::PlanRenderer
- Defined in:
- lib/dnsmadeeasy/zone/plan_renderer.rb
Overview
Renders zone plans for humans and automation.
Instance Method Summary collapse
-
#initialize(plan) ⇒ PlanRenderer
constructor
A new instance of PlanRenderer.
- #to_json ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(plan) ⇒ PlanRenderer
Returns a new instance of PlanRenderer.
9 10 11 |
# File 'lib/dnsmadeeasy/zone/plan_renderer.rb', line 9 def initialize(plan) @plan = plan end |
Instance Method Details
#to_json ⇒ Object
25 26 27 |
# File 'lib/dnsmadeeasy/zone/plan_renderer.rb', line 25 def to_json(*) JSON.pretty_generate(plan_hash) end |
#to_text ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dnsmadeeasy/zone/plan_renderer.rb', line 13 def to_text return "No changes.\n" if plan.empty? [ section('Create', plan.creates), section('Update', plan.updates), section('Skipped Creates', plan.skipped_creates), section('Skipped Deletes', plan.skipped_deletes), section('Manual Review', plan.ambiguous) ].reject(&:empty?).join("\n") end |