lib/scrivito/membership_collection.rb in scrivito_sdk-0.70.2 vs lib/scrivito/membership_collection.rb in scrivito_sdk-0.71.0.rc1
- old
+ new
@@ -1,21 +1,21 @@
module Scrivito
# @api public
- # The MembershipCollection includes all members of a given {Workspace}.
- # You can access it using the {Workspace#memberships} method.
+ # The Scrivito::MembershipCollection includes all members of a given {Scrivito::Workspace}.
+ # You can access it using the {Scrivito::Workspace#memberships} method.
class MembershipCollection
extend Forwardable
include Enumerable
attr_reader :workspace
# @api public
# @!method each
- # Iterate over all {Membership Memberships} of a specific {Workspace}. Allows
- # you to use all the methods defined by Ruby's Enumerable module.
+ # Iterate over all {Scrivito::Membership Memberships} of a specific {Scrivito::Workspace}.
+ # Allows you to use all the methods defined by Ruby's Enumerable module.
#
- # @yield [Membership]
+ # @yield [Scrivito::Membership]
#
# @return [Enumerator] if no block is given, an Enumerator is returned
#
# @example
# # Obtain all owners of a workspace.
@@ -39,22 +39,22 @@
@workspace = workspace
end
# @api public
# Returns a hash where the keys are +user_id+s and the values are Membership instances.
- # @return [Hash<String, Membership>]
+ # @return [Hash<String, Scrivito::Membership>]
def to_h
memberships.inject(HashWithIndifferentAccess.new) do |hash, membership|
hash[membership.user_id] = membership
hash
end
end
# @api public
# Returns the membership of a user or nil.
#
- # @param [User, String] id_or_user
- # @return [Membership, nil]
+ # @param [Scrivito::User, String] id_or_user
+ # @return [Scrivito::Membership, nil]
def [](id_or_user)
id = if id_or_user.respond_to?(:id)
id_or_user.id
else
id_or_user