Method: GoodData::Model::ProjectBlueprint#merge
- Defined in:
- lib/gooddata/models/blueprint/project_blueprint.rb
#merge(a_blueprint) ⇒ GoodData::Model::ProjectBlueprint
Merging two blueprints. A new blueprint is created. The self one is nto mutated
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/gooddata/models/blueprint/project_blueprint.rb', line 655 def merge(a_blueprint) temp_blueprint = dup return temp_blueprint unless a_blueprint a_blueprint.datasets.each do |dataset| if temp_blueprint.dataset?(dataset.id) local_dataset = temp_blueprint.find_dataset(dataset.id) index = temp_blueprint.datasets.index(local_dataset) local_dataset.merge!(dataset) temp_blueprint.remove_dataset!(local_dataset.id) temp_blueprint.add_dataset!(local_dataset, index) else temp_blueprint.add_dataset!(dataset.dup) end end a_blueprint.date_dimensions.each do |dd| if temp_blueprint.dataset?(dd.id, dd: true) local_dim = temp_blueprint.data[:date_dimensions].find { |d| d[:id] == dd.id } local_dim[:urn] = dd.urn else temp_blueprint.add_date_dimension!(dd.dup) end end temp_blueprint end |