lib/scrivito/membership_collection.rb in scrivito_sdk-0.65.2 vs lib/scrivito/membership_collection.rb in scrivito_sdk-0.66.0.rc1
- old
+ new
@@ -8,19 +8,19 @@
attr_reader :workspace
# @api public
# @!method each
- # Iterate over all {Membership Memberships} of a specfic {Workspace}. Allows
+ # Iterate over all {Membership Memberships} of a specific {Workspace}. Allows
# you to use all methods defined by ruby's Enumerable module.
#
# @yield [Membership]
#
# @return [Enumerator] if no block is given an Enumerator is returned
#
# @example
- # # Optain all owners of a workspace
+ # # Obtain all owners of a workspace
# my_workspace.memberships.select do |membership|
# membership.role == "owner"
# end
#
# # Get an array of all the members' user_ids
@@ -69,9 +69,10 @@
end
private
def memberships
+ return [] if workspace.published?
@memberships ||= begin
workspace.data.memberships.map do |id, data|
Membership.new(id, data)
end
end