lib/surrounded/context/initializing.rb in surrounded-0.9.0 vs lib/surrounded/context/initializing.rb in surrounded-0.9.1
- old
+ new
@@ -1,25 +1,18 @@
module Surrounded
module Context
module Initializing
- def new(*args, &block)
- instance = allocate
- instance.send(:initialize, *args, &block)
- instance
- end
-
# Shorthand for creating an instance level initialize method which
# handles the mapping of the given arguments to their named role.
def initialize(*setup_args)
private_attr_reader(*setup_args)
mod = Module.new
line = __LINE__
mod.class_eval "
def initialize(#{setup_args.join(',')})
- arguments = method(__method__).parameters.map{|arg| eval(arg[1].to_s) }
@role_map = RoleMap.new
- map_roles(#{setup_args}.zip(arguments))
+ map_roles(#{setup_args.to_s}.zip([#{setup_args.join(',')}]))
end
", __FILE__, line
const_set("ContextInitializer", mod)
include mod
end
\ No newline at end of file