提交 fec0f067 编写于 作者: J Jeremy Kemper

Merge branch 'master' into erbout

require 'cgi'
require 'erb'
require 'set'
module ActionView
module Helpers #:nodoc:
......@@ -8,7 +9,8 @@ module Helpers #:nodoc:
module TagHelper
include ERB::Util
BOOLEAN_ATTRIBUTES = Set.new(%w(disabled readonly multiple))
BOOLEAN_ATTRIBUTES = %w(disabled readonly multiple).to_set
BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map(&:to_sym))
# Returns an empty HTML tag of type +name+ which by default is XHTML
# compliant. Set +open+ to true to create an open tag compatible
......@@ -37,7 +39,7 @@ module TagHelper
# tag("img", { :src => "open & shut.png" }, false, false)
# # => <img src="open &amp; shut.png" />
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}" + (open ? ">" : " />")
"<#{name}#{tag_options(options, escape) if options}#{open ? ">" : " />"}"
end
# Returns an HTML block tag of type +name+ surrounding the +content+. Add
......@@ -111,7 +113,6 @@ def tag_options(options, escape = true)
if escape
options.each do |key, value|
next unless value
key = key.to_s
value = BOOLEAN_ATTRIBUTES.include?(key) ? key : escape_once(value)
attrs << %(#{key}="#{value}")
end
......
......@@ -2064,13 +2064,18 @@ def replace_named_bind_variables(statement, bind_vars) #:nodoc:
end
def expand_range_bind_variables(bind_vars) #:nodoc:
bind_vars.sum do |var|
expanded = []
bind_vars.each do |var|
if var.is_a?(Range)
[var.first, var.last]
expanded << var.first
expanded << var.last
else
[var]
expanded << var
end
end
expanded
end
def quote_bound_value(value) #:nodoc:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册