Method: GoodData::MdObject.replace_bracketed

Defined in:
lib/gooddata/models/metadata.rb

.replace_bracketed(obj, mapping) ⇒ GoodData::MdObject

Method used for replacing objects like Attribute, Fact or Metric. It takes the object. Scans its JSON representation and returns a new one with object references changed according to mapping. The references an be found either in the object structure or in the MAQL in bracketed form. This implementation takes care only of those in bracketed form.

Parameters:

  • obj (GoodData::MdObject)

    what Object that should be replaced

  • mapping (Array[Array])

    Array of mapping pairs.

Returns:



42
43
44
# File 'lib/gooddata/models/metadata.rb', line 42

def replace_bracketed(obj, mapping)
  replace(obj, mapping) { |e, a, b| e.gsub("[#{a}]", "[#{b}]") }
end