lib/surrounded/context/role_builders.rb in surrounded-0.9.9 vs lib/surrounded/context/role_builders.rb in surrounded-0.9.10
- old
+ new
@@ -1,7 +1,17 @@
module Surrounded
module Context
+ class InvalidRoleType < ::StandardError
+ unless method_defined?(:cause)
+ def initialize(msg=nil)
+ super
+ @cause = $!
+ end
+ attr_reader :cause
+ end
+ end
+
module RoleBuilders
# Define behaviors for your role players
def role(name, type=default_role_type, &block)
if type == :module
@@ -11,10 +21,10 @@
else
meth = method(type)
meth.call(name, &block)
end
rescue NameError => e
- raise InvalidRoleType, e.message
+ raise self::InvalidRoleType, e.message
end
alias_method :role_methods, :role
# Create a named behavior for a role using the standard library SimpleDelegator.
def wrap(name, &block)
\ No newline at end of file