lib/surrounded/context.rb in surrounded-0.9.4 vs lib/surrounded/context.rb in surrounded-0.9.5
- old
+ new
@@ -114,10 +114,22 @@
# Return a Set of all defined triggers
def triggers
self.class.triggers
end
+ def rebind(options_hash)
+ clear_instance_variables
+ initialize(options_hash.to_a)
+ rescue ArgumentError
+ initialize(*options_hash.values)
+ self
+ end
+
private
+
+ def clear_instance_variables
+ instance_variables.each{|ivar| remove_instance_variable(ivar) }
+ end
def role_map
@role_map ||= role_mapper_class.new
end
\ No newline at end of file