vendor/rails/actionmailer/lib/action_mailer/helpers.rb in radiant-0.6.9 vs vendor/rails/actionmailer/lib/action_mailer/helpers.rb in radiant-0.7.0
- old
+ new
@@ -20,11 +20,11 @@
end
end
module ClassMethods
# Makes all the (instance) methods in the helper module available to templates rendered through this controller.
- # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
+ # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
# available to the templates.
def add_template_helper(helper_module) #:nodoc:
master_helper_module.module_eval "include #{helper_module}"
end
@@ -32,22 +32,22 @@
# helper :foo
# requires 'foo_helper' and includes FooHelper in the template class.
# helper FooHelper
# includes FooHelper in the template class.
# helper { def foo() "#{bar} is the very best" end }
- # evaluates the block in the template class, adding method #foo.
+ # evaluates the block in the template class, adding method +foo+.
# helper(:three, BlindHelper) { def mice() 'mice' end }
# does all three.
def helper(*args, &block)
args.flatten.each do |arg|
case arg
when Module
add_template_helper(arg)
when String, Symbol
file_name = arg.to_s.underscore + '_helper'
class_name = file_name.camelize
-
+
begin
require_dependency(file_name)
rescue LoadError => load_error
requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1]
msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}"
@@ -85,20 +85,20 @@
# The is a convenience wrapper for helper_method.
def helper_attr(*attrs)
attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
end
- private
+ private
def inherited_with_helper(child)
inherited_without_helper(child)
begin
child.master_helper_module = Module.new
child.master_helper_module.send! :include, master_helper_module
- child.helper child.name.underscore
+ child.helper child.name.to_s.underscore
rescue MissingSourceFile => e
- raise unless e.is_missing?("helpers/#{child.name.underscore}_helper")
+ raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
end
- end
+ end
end
private
# Extend the template class instance with our controller's helper module.
def initialize_template_class_with_helper(assigns)