File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
lib/hippo/transaction_sets Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -90,16 +90,30 @@ def method_missing(method_name, *args)
9090 yield component if block_given?
9191
9292 values [ component_entry [ :sequence ] ] = if component_entry [ :maximum ] > 1
93- RepeatingComponent [ component ]
93+ RepeatingComponent . new ( component_entry [ :class ] , self , component )
9494 else
9595 component
9696 end
97- else
98- return values [ component_entry [ :sequence ] ]
9997 end
98+
99+ return values [ component_entry [ :sequence ] ]
100100 end
101101
102102 class RepeatingComponent < Array
103+ def initialize ( klass , parent , *args )
104+ @klass = klass
105+ @parent = parent
106+
107+ self . push ( *args )
108+ end
109+
110+ def build
111+ self . push ( @klass . new :parent => @parent )
112+
113+ yield self [ -1 ] if block_given?
114+ self [ -1 ]
115+ end
116+
103117 def to_s
104118 self . map ( &:to_s ) . join
105119 end
You can’t perform that action at this time.
0 commit comments