Class: Vident::Internals::Draft
- Inherits:
-
Object
- Object
- Vident::Internals::Draft
- Defined in:
- lib/vident/internals/draft.rb
Overview
Per-instance mutable accumulator; seals into a frozen Plan once rendering begins.
Instance Method Summary collapse
-
#initialize(**collections) ⇒ Draft
constructor
A new instance of Draft.
- #plan ⇒ Object
- #seal! ⇒ Object
- #sealed? ⇒ Boolean
Constructor Details
#initialize(**collections) ⇒ Draft
Returns a new instance of Draft.
10 11 12 13 14 |
# File 'lib/vident/internals/draft.rb', line 10 def initialize(**collections) @collections = Registry.names.to_h { |name| [name, []] } collections.each { |k, v| @collections[k] = v.dup if @collections.key?(k) } @sealed = false end |
Instance Method Details
#plan ⇒ Object
36 |
# File 'lib/vident/internals/draft.rb', line 36 def plan = seal! |
#seal! ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/vident/internals/draft.rb', line 28 def seal! return @plan if @sealed @sealed = true @collections.each_value(&:freeze) @collections.freeze @plan = Plan.new(**@collections) end |
#sealed? ⇒ Boolean
26 |
# File 'lib/vident/internals/draft.rb', line 26 def sealed? = @sealed |