aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-28 07:16:55 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-28 07:16:55 +0000
commit0eacdcf9a3e37e05f47a4ded7f0a4aff3b65fbe4 (patch)
tree74705adf7f9a35c750f74657f0c4a29a6dcce5ff /actionpack/lib/action_view
parent4ac332fa9a16ae86b948251e372999b9f4618dec (diff)
downloadrails-0eacdcf9a3e37e05f47a4ded7f0a4aff3b65fbe4.tar.gz
rails-0eacdcf9a3e37e05f47a4ded7f0a4aff3b65fbe4.tar.bz2
rails-0eacdcf9a3e37e05f47a4ded7f0a4aff3b65fbe4.zip
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
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb14
-rw-r--r--actionpack/lib/action_view/helpers/active_record_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/java_script_macros_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/scriptaculous_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb16
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb2
12 files changed, 24 insertions, 34 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index dfe421c312..303a946186 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -157,7 +157,7 @@ module ActionView #:nodoc:
attr_accessor :controller
attr_reader :logger, :response, :headers
- attr_internal *ActionController::Base::DEPRECATED_INSTANCE_VARIABLES
+ attr_internal(*ActionController::Base::DEPRECATED_INSTANCE_VARIABLES)
# Specify trim mode for the ERB compiler. Defaults to '-'.
# See ERB documentation for suitable values.
@@ -210,12 +210,14 @@ module ActionView #:nodoc:
class ObjectWrapper < Struct.new(:value) #:nodoc:
end
- def self.load_helpers(helper_dir)#:nodoc:
- Dir.entries(helper_dir).sort.each do |helper_file|
- next unless helper_file =~ /^([a-z][a-z_]*_helper).rb$/
- require File.join(helper_dir, $1)
+ def self.load_helpers #:nodoc:
+ Dir.entries("#{File.dirname(__FILE__)}/helpers").sort.each do |file|
+ next unless file =~ /^([a-z][a-z_]*_helper).rb$/
+ require "action_view/helpers/#{$1}"
helper_module_name = $1.camelize
- class_eval("include ActionView::Helpers::#{helper_module_name}") if Helpers.const_defined?(helper_module_name)
+ if Helpers.const_defined?(helper_module_name)
+ include Helpers.const_get(helper_module_name)
+ end
end
end
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\b.*?>(.*?)<\/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: