diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-09-18 02:37:24 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-09-18 02:37:49 -0600 |
| commit | b574b0cd9f4b7dccdfc12e7e723f6dfeaabd0879 (patch) | |
| tree | 7dcf09adcb3b5a4da90c82ac6d52b0af8b32f6fd | |
| parent | 5cb168afc704ed5f6ffe6784f2f105ed89dff9bc (diff) | |
slight optimization in AbstractBlock initializer
| -rw-r--r-- | lib/asciidoctor/abstract_node.rb | 8 |
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 |
