Browse files

Cleanup.

  • Loading branch information...
1 parent f2fe0f3 commit 15467b14f02435e938d3e7748620c322eeaf0ef6 @tobie tobie committed Nov 1, 2010
Showing with 2 additions and 4 deletions.
  1. +1 −1 bin/modulrize
  2. +1 −3 lib/modulr/global_export_collector.rb
View
2 bin/modulrize
@@ -31,7 +31,7 @@ opts = OptionParser.new do |opts|
options[:minify] = minify
end
- opts.on('--global-export[=GLOBAL_VAR]', 'If GLOBAL_VAR is specified and only one module is being processed, exports it to the GLOBAL_VAR global variable.', 'If GLOBAL_VAR is specified and multiple modules are being processed, exports each one of them as a property of GLOBAL_VAR.', 'If GLOBAL_VAR isn\'t specified, exports the module to global variables corresponding to their identifier.') do |global|
+ opts.on('--global-export[=GLOBAL_VAR]', 'If GLOBAL_VAR is specified and only one module is being processed, export it to the GLOBAL_VAR global variable.', 'If GLOBAL_VAR is specified and multiple modules are being processed, export each one of them as a property of GLOBAL_VAR.', 'If GLOBAL_VAR isn\'t specified, export the module to global variables corresponding to their identifier.') do |global|
options[:global] = global || true
end
View
4 lib/modulr/global_export_collector.rb
@@ -35,9 +35,7 @@ def define_global_var(var_name)
def requires
if use_module_id_as_var_name?
- top_level_modules.inject('') do |str, m|
- str << "\n #{m.id} = require('#{m.id}');"
- end
+ top_level_modules.map { |m| "\n #{m.id} = require('#{m.id}');" }.join
elsif top_level_modules.size == 1
#export to named global
"\n #{global_var_name} = require('#{top_level_modules.first.id}');"

0 comments on commit 15467b1

Please sign in to comment.