Class: Slamdown::Conversion::PreparedNode

Inherits:
Object
  • Object
show all
Defined in:
lib/slamdown/conversion/prepared_node.rb

Overview

Captures parser facts together with the immutable, conversion-specific decisions needed by normalisation and rendering.

Constant Summary collapse

PARSER_ATTRIBUTES =
[:kind, :source_name, :semantic_kind, :category, :content_model, :value, :properties, :source_form, :synthetic].freeze
PREPARATION_ATTRIBUTES =
[:action, :attributes, :attribute_policies, :classes, :class_policies, :id, :id_policy, :semantic_values, :children].freeze
ATTRIBUTES =
(PARSER_ATTRIBUTES + PREPARATION_ATTRIBUTES).freeze

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ PreparedNode

Returns a new instance of PreparedNode.



14
15
16
17
18
19
# File 'lib/slamdown/conversion/prepared_node.rb', line 14

def initialize(values)
	ATTRIBUTES.each do |attribute|
		instance_variable_set("@#{attribute}", Immutable.copy(values.fetch(attribute)))
	end
	freeze
end