From 0eacdcf9a3e37e05f47a4ded7f0a4aff3b65fbe4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 28 Jan 2007 07:16:55 +0000 Subject: Use a consistent load path to avoid double requires. Fix some scattered Ruby warnings. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6057 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_view/helpers/active_record_helper.rb | 2 +- actionpack/lib/action_view/helpers/asset_tag_helper.rb | 4 ++-- actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-- .../lib/action_view/helpers/form_options_helper.rb | 2 +- actionpack/lib/action_view/helpers/form_tag_helper.rb | 2 +- .../lib/action_view/helpers/java_script_macros_helper.rb | 2 +- actionpack/lib/action_view/helpers/javascript_helper.rb | 4 ++-- actionpack/lib/action_view/helpers/prototype_helper.rb | 4 ++-- .../lib/action_view/helpers/scriptaculous_helper.rb | 2 +- actionpack/lib/action_view/helpers/text_helper.rb | 16 ++-------------- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- 11 files changed, 16 insertions(+), 28 deletions(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index 33eaa13898..dcaf54be46 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -1,5 +1,5 @@ require 'cgi' -require File.dirname(__FILE__) + '/form_helper' +require 'action_view/helpers/form_helper' module ActionView class Base diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index fedbf262a1..b2a0d5344a 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -1,6 +1,6 @@ require 'cgi' -require File.dirname(__FILE__) + '/url_helper' -require File.dirname(__FILE__) + '/tag_helper' +require 'action_view/helpers/url_helper' +require 'action_view/helpers/tag_helper' module ActionView module Helpers #:nodoc: diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index dc9ef4f9ef..045852d8db 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1,6 +1,6 @@ require 'cgi' -require File.dirname(__FILE__) + '/date_helper' -require File.dirname(__FILE__) + '/tag_helper' +require 'action_view/helpers/date_helper' +require 'action_view/helpers/tag_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 6b3da64f7d..4dafc471f8 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -1,6 +1,6 @@ require 'cgi' require 'erb' -require File.dirname(__FILE__) + '/form_helper' +require 'action_view/helpers/form_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 3de3a9372b..3b0e555bbd 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -1,5 +1,5 @@ require 'cgi' -require File.dirname(__FILE__) + '/tag_helper' +require 'action_view/helpers/tag_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb index 463fe0e120..6304a1a8b2 100644 --- a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +++ b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/tag_helper' +require 'action_view/helpers/tag_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 7bce6b91eb..ad74a85584 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -1,5 +1,5 @@ -require File.dirname(__FILE__) + '/tag_helper' -require File.dirname(__FILE__) + '/prototype_helper' +require 'action_view/helpers/tag_helper' +require 'action_view/helpers/prototype_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 43d04baf8d..ed3f7b7d7f 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -860,7 +860,7 @@ module ActionView add_variable_assignment!(options[:variable]) if options[:variable] append_enumerable_function!("#{enumerable.to_s.camelize(:lower)}(#{method_args}function(#{yield_args}) {") # only yield as many params as were passed in the block - yield *options[:yield_args].collect { |p| JavaScriptVariableProxy.new(@generator, p) }[0..block.arity-1] + yield(*options[:yield_args].collect { |p| JavaScriptVariableProxy.new(@generator, p) }[0..block.arity-1]) add_return_statement! if options[:return] @generator << '});' end @@ -889,4 +889,4 @@ module ActionView end end -require File.dirname(__FILE__) + '/javascript_helper' +require 'action_view/helpers/javascript_helper' diff --git a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb index 2c416b0026..f79a3c50e3 100644 --- a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +++ b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/javascript_helper' +require 'action_view/helpers/javascript_helper' module ActionView module Helpers diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 236e1492ac..e60f6c2986 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -1,4 +1,5 @@ -require File.dirname(__FILE__) + '/tag_helper' +require 'action_view/helpers/tag_helper' +require 'html/document' module ActionView module Helpers #:nodoc: @@ -192,19 +193,6 @@ module ActionView text.gsub(/(.*?)<\/a>/mi, '\1') end - # Try to require the html-scanner library - begin - require 'html/tokenizer' - require 'html/node' - rescue LoadError - # if there isn't a copy installed, use the vendor version in - # ActionController - $:.unshift File.join(File.dirname(__FILE__), "..", "..", - "action_controller", "vendor", "html-scanner") - require 'html/tokenizer' - require 'html/node' - end - VERBOTEN_TAGS = %w(form script plaintext) unless defined?(VERBOTEN_TAGS) VERBOTEN_ATTRS = /^on/i unless defined?(VERBOTEN_ATTRS) diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 6a66585387..4e911b94bf 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/javascript_helper' +require 'action_view/helpers/javascript_helper' module ActionView module Helpers #:nodoc: -- cgit v1.2.3