Permalink
Browse files

Merge pull request #5 from wicz/person_decorator

Person decorator
  • Loading branch information...
2 parents 597704c + 6d7f0d1 commit c76984db07dd206f1a3c14b1234aa55519993ad0 @seejee seejee committed Mar 20, 2012
Showing with 4 additions and 8 deletions.
  1. +4 −8 app/decorators/person_decorator.rb
@@ -1,14 +1,10 @@
-class PersonDecorator
- extend Forwardable
+class PersonDecorator < ApplicationDecorator
+ decorates :person, :class => Clubhouse::Client::Person
- def_delegators :@person, :name, :email, :github_nickname, :permissions
-
- def initialize(person)
- @person = person
- end
+ allows :name, :email, :github_nickname, :permissions
def has_role?(role, course)
- membership = course.course_memberships.for_person(@person).first
+ membership = course.course_memberships.for_person(person).first
membership.has_role?(role) if membership
end
end

0 comments on commit c76984d

Please sign in to comment.