summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2014-09-18 02:37:24 -0600
committerDan Allen <dan.j.allen@gmail.com>2014-09-18 02:37:49 -0600
commitb574b0cd9f4b7dccdfc12e7e723f6dfeaabd0879 (patch)
tree7dcf09adcb3b5a4da90c82ac6d52b0af8b32f6fd
parent5cb168afc704ed5f6ffe6784f2f105ed89dff9bc (diff)
slight optimization in AbstractBlock initializer
-rw-r--r--lib/asciidoctor/abstract_node.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/asciidoctor/abstract_node.rb b/lib/asciidoctor/abstract_node.rb
index ed8cc67b..67a24dae 100644
--- a/lib/asciidoctor/abstract_node.rb
+++ b/lib/asciidoctor/abstract_node.rb
@@ -27,19 +27,17 @@ class AbstractNode
def initialize parent, context, opts = {}
# document is a special case, should refer to itself
if context == :document
- @parent = nil
@document = parent
else
- if (@parent = parent)
+ if parent
+ @parent = parent
@document = parent.document
- else
- @document = nil
end
end
@context = context
@node_name = context.to_s
# QUESTION are we correct in duplicating the attributes (seems to be just as fast)
- @attributes = opts.key?(:attributes) ? (opts[:attributes] || {}).dup : {}
+ @attributes = (opts.key? :attributes) ? opts[:attributes].dup : {}
@passthroughs = {}
end