lib/gooddata/models/metadata/metric.rb in gooddata-0.6.11 vs lib/gooddata/models/metadata/metric.rb in gooddata-0.6.12
- old
+ new
@@ -15,12 +15,10 @@
alias_method :to_hash, :json
include GoodData::Mixin::RestResource
root_key :metric
- PARSE_MAQL_OBJECT_REGEXP = /\[([^\]]+)\]/
-
class << self
# Method intended to get all objects of that type in a specified project
#
# @param options [Hash] the options hash
# @option options [Boolean] :full if passed true the subclass can decide to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default
@@ -210,29 +208,9 @@
end
# Looks up the readable values of the objects used inside of MAQL epxpressions. Labels and elements titles are based on the primary label.
# @return [String] Ther resulting MAQL like expression
def pretty_expression
- opts = {
- :client => client,
- :project => project
- }
-
- temp = expression.dup
- pairs = expression.scan(PARSE_MAQL_OBJECT_REGEXP).pmap do |uri|
- uri = uri.first
- if uri =~ /elements/
- [uri, Attribute.find_element_value(uri, opts)]
- else
- [uri, GoodData::MdObject[uri, opts].title]
- end
- end
-
- pairs.each do |el|
- uri = el[0]
- obj = el[1]
- temp.sub!(uri, obj)
- end
- temp
+ SmallGoodZilla.pretty_print(expression, client: client, project: project)
end
end
end