Module: Roleful::InstanceMethods
- Defined in:
- lib/roleful/inclusion.rb
Instance Method Summary collapse
-
#with_role(*tmp_roles) ⇒ Object
(also: #with_roles)
Gives an object temporary roles for the duration of the block.
Instance Method Details
#with_role(*tmp_roles) ⇒ Object Also known as: with_roles
Gives an object temporary roles for the duration of the block.
14 15 16 17 18 19 20 |
# File 'lib/roleful/inclusion.rb', line 14 def with_role(*tmp_roles) old_role = method(:role) (:role) { tmp_roles } result = yield { define_method(:role, old_role) } result end |