# File lib/rhc/rest/membership.rb, line 62 def <=>(other) [role_weight, type, name, id] <=> [other.role_weight, other.type, other.name, other.id] end
# File lib/rhc/rest/membership.rb, line 11 def admin? role == 'admin' end
# File lib/rhc/rest/membership.rb, line 15 def editor? role == 'edit' end
# File lib/rhc/rest/membership.rb, line 35 def explicit_role? explicit_role.present? end
# File lib/rhc/rest/membership.rb, line 39 def from Array(attributes['from']) end
# File lib/rhc/rest/membership.rb, line 43 def grant_from?(type, id) from.detect {|f| f['type'] == type && f['id'] == id} end
# File lib/rhc/rest/membership.rb, line 27 def name attributes['name'] || login end
# File lib/rhc/rest/membership.rb, line 66 def role_weight if owner? 0 else case role when 'admin' then 1 when 'edit' then 2 when 'view' then 3 else 4 end end end
# File lib/rhc/rest/membership.rb, line 23 def team? type == 'team' end
# File lib/rhc/rest/membership.rb, line 47 def teams(members) team_ids = from.inject([]) {|ids, f| ids << f['id'] if f['type'] == 'team'; ids } members.select {|m| m.team? && team_ids.include?(m.id) } end
# File lib/rhc/rest/membership.rb, line 52 def to_s if name == login "#{login} (#{role})" elsif login "#{name} <#{login}> (#{role})" else "#{name} (#{role})" end end
Generated with the Darkfish Rdoc Generator 2.