lib/surrounded/context/initializing.rb in surrounded-0.9.3 vs lib/surrounded/context/initializing.rb in surrounded-0.9.4
- old
+ new
@@ -1,11 +1,11 @@
module Surrounded
module Context
module Initializing
# Shorthand for creating an instance level initialize method which
# handles the mapping of the given arguments to their named role.
- def initialize(*setup_args)
+ def initialize_without_keywords(*setup_args)
private_attr_reader(*setup_args)
mod = Module.new
line = __LINE__
mod.class_eval "
@@ -14,9 +14,14 @@
map_roles(#{setup_args.to_s}.zip([#{setup_args.join(',')}]))
end
", __FILE__, line
const_set("ContextInitializer", mod)
include mod
+ end
+ def initialize(*setup_args)
+ warn "Deprecated: The behavior of 'initialize' will require keywords in the future
+ Consider using keyword arguments or switching to 'initialize_without_keywords'\n\n"
+ initialize_without_keywords(*setup_args)
end
def keyword_initialize(*setup_args)
private_attr_reader(*setup_args)
\ No newline at end of file