lib/rake/funnel/support/internal/instantiate_symbol.rb in rake-funnel-0.3.2.pre vs lib/rake/funnel/support/internal/instantiate_symbol.rb in rake-funnel-0.4.0.pre
- old
+ new
@@ -1,34 +1,38 @@
-module Rake::Funnel::Support
- module InstantiateSymbol
- def self.included(klass)
- klass.extend(ClassMethods)
- klass.send(:instantiate, klass)
- end
-
- module ClassMethods
- attr_reader :module
-
- private
- def instantiate(mod)
- @module = mod
- end
- end
-
- private
- def create(sym, *args)
- return sym unless sym.kind_of?(Symbol)
-
- begin
- type = self.class.module.const_get(sym)
- rescue NameError
- raise NameError, "Unknown type to instantiate: #{sym.inspect}. Available types are: #{available.inspect}"
- end
-
- type.new(*args)
- end
-
- def available
- return self.class.module.constants.sort
- end
- end
-end
+module Rake
+ module Funnel
+ module Support
+ module InstantiateSymbol
+ def self.included(klass)
+ klass.extend(ClassMethods)
+ klass.send(:instantiate, klass)
+ end
+
+ module ClassMethods
+ attr_reader :module
+
+ private
+ def instantiate(mod)
+ @module = mod
+ end
+ end
+
+ private
+ def create(sym, *args)
+ return sym unless sym.is_a?(Symbol)
+
+ begin
+ type = self.class.module.const_get(sym)
+ rescue NameError
+ raise NameError, "Unknown type to instantiate: #{sym.inspect}. Available types are: #{available.inspect}"
+ end
+
+ type.new(*args)
+ end
+
+ def available
+ self.class.module.constants.sort
+ end
+ end
+ end
+ end
+end