Module: Babl::Operators::Merge::DSL
- Included in:
- Template
- Defined in:
- lib/babl/operators/merge.rb
Instance Method Summary collapse
-
#merge(*templates) ⇒ Object
Merge multiple JSON objects (non-deep).
Instance Method Details
#merge(*templates) ⇒ Object
Merge multiple JSON objects (non-deep)
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/babl/operators/merge.rb', line 10 def merge(*templates) return call(Utils::Hash::EMPTY) if templates.empty? templates = templates.map { |t| unscoped.reset_continue.call(t) } construct_terminal { |context| Nodes::Merge.new( templates.map { |t| t.builder.precompile(Nodes::TerminalValue.instance, context) } ) } end |