opulent 1.4.6 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05d310bfbdbf90ef6c0fab56f07cd3f270b625be
4
- data.tar.gz: 070eba90f7f4ec83d427642268b1e1138c0ca7df
3
+ metadata.gz: 2c8acd296b42eefdc3b2e9fb0a558e6a30a236b1
4
+ data.tar.gz: 23878031df261bc6e3379318ebac323b9293654b
5
5
  SHA512:
6
- metadata.gz: 1497de762406f57d97afec44f8cd3f02b80a20202fbfeba31a1ce32fa324751e5fb5687f0408d5920c32b971873c47b9035946f452d129520f3f97066e9c4aee
7
- data.tar.gz: 959f0e1d74856caccbada40bdfdddedd2de2548dc5bbb34eb35a785eab1911fdf8634374c7bbbcccf6b69de7f8872b26d49dc436c9e4afc6e31f2deaae61e87f
6
+ metadata.gz: 33463ff92a452d7c9d8bdc399c6cb3ea26b0bd51b981b187def57d6b66970449a157e40463f83642d596336030ac04fba6cf21effb6a0d69bd61f1ac200f0290
7
+ data.tar.gz: 756bd4620c6cb515357926ac658cfe666eccdb8423a2a739c190c3ae38defbcb6637ed22b928b9037cb35fc233046cf22f5408f4d0a4950459339c7740b57c97
@@ -35,6 +35,10 @@ module Opulent
35
35
  # be used with the last parent path found
36
36
  @file = [[file, -1]]
37
37
 
38
+ # Create a definition stack to disallow recursive calls. When inside a
39
+ # definition and a named node is called, we render it as a plain node
40
+ @definition_stack = []
41
+
38
42
  # Initialize definitions for the parser
39
43
  @definitions = definitions
40
44
  end
@@ -24,9 +24,7 @@ module Opulent
24
24
  # Set definition as root node and let the parser know that we're inside
25
25
  # a definition. This is used because inside definitions we do not process
26
26
  # nodes (we do not check if they are have a definition or not).
27
- @inside_definition = name
28
- root(definition, indent)
29
- @inside_definition = nil
27
+ root definition, indent
30
28
 
31
29
  # Add to parent
32
30
  @definitions[name] = definition
@@ -80,8 +80,10 @@ module Opulent
80
80
 
81
81
  # Create a clone of the definition model. Cloning the options is also
82
82
  # necessary because it's a shallow copy
83
- if @inside_definition != node_name && @definitions.keys.include?(node_name)
83
+ if @definitions.keys.include?(node_name)
84
+ @definition_stack << node_name
84
85
  parent[@children] << process_definition(node_name, current_node)
86
+ @definition_stack.pop
85
87
  else
86
88
  parent[@children] << current_node
87
89
  end
@@ -111,7 +113,7 @@ module Opulent
111
113
  def process_definition_child(node)
112
114
  node[@children].map! do |child|
113
115
  if child[@type] == :node
114
- if @definitions.keys.include? child[@value]
116
+ if !@definition_stack.include?(node[@value]) && @definitions.keys.include?(child[@value])
115
117
  process_definition child[@value], child
116
118
  else
117
119
  process_definition_child child if child[@children]
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = "1.4.6"
3
+ VERSION = "1.4.7"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav