module GoodData::Mixin::MdFinders
Public Instance Methods
Source
# File lib/gooddata/mixins/md_finders.rb, line 30 def find_by_identifier(identifier, options = { :client => GoodData.connection, :project => GoodData.project }) all = self[:all, options] items = if identifier.is_a?(Regexp) all.select { |r| r.title =~ identifier } else all.select { |r| r.title == identifier } end items.pmap { |item| self[item.uri, options] unless item.nil? } end
Finds a specific type of the object by identifier. Returns all matches. Returns full object.
@param title [String] identifier that has to match exactly @param title [Regexp] regular expression that has to match @return [Array<GoodData::MdObject>] Array of MdObject
Source
# File lib/gooddata/mixins/md_finders.rb, line 40 def find_by_tag(tags, opts = { :client => GoodData.connection, :project => GoodData.project }) client, project = GoodData.get_client_and_project(opts) tags = tags.split(',').map(&:strip) unless tags.is_a?(Array) self[:all, client: client, project: project] .select { |r| (r.tag_set & tags).any? } end
Source
# File lib/gooddata/mixins/md_finders.rb, line 68 def find_by_title(title, options = { :client => GoodData.connection, :project => GoodData.project }) all = self[:all, options] items = if title.is_a?(Regexp) all.select { |r| r.title =~ title } else all.select { |r| r.title == title } end items.pmap { |item| self[item.uri, options] unless item.nil? } end
Finds a specific type of the object by title. Returns all matches. Returns full object.
@param title [String] title that has to match exactly @param title [Regexp] regular expression that has to match @return [Array<GoodData::MdObject>] Array of MdObject
Source
# File lib/gooddata/mixins/md_finders.rb, line 15 def find_first_by_identifier(identifier, options = { :client => GoodData.connection, :project => GoodData.project }) all = self[:all, options.merge(full: false)] item = if identifier.is_a?(Regexp) all.find { |r| r.identifier =~ identifier } else all.find { |r| r.identifier == identifier } end self[item.uri, options] unless item.nil? end
Finds a specific type of the object by identifier. Returns first match. Returns full object.
@param title [String] identifier that has to match exactly @param title [Regexp] regular expression that has to match @return [Array<GoodData::MdObject>] Array of MdObject
Source
# File lib/gooddata/mixins/md_finders.rb, line 53 def find_first_by_title(title, options = { :client => GoodData.connection, :project => GoodData.project }) all = self[:all, options] item = if title.is_a?(Regexp) all.find { |r| r.title =~ title } else all.find { |r| r.title == title } end self[item.uri, options] unless item.nil? end
Finds a specific type of the object by title. Returns first match. Returns full object.
@param title [String] title that has to match exactly @param title [Regexp] regular expression that has to match @return [Array<GoodData::MdObject>] Array of MdObject