Eliminate some String garbage

This commit is contained in:
Yehuda Katz 2012-09-16 20:08:30 -07:00
parent 9da0176d2b
commit a025f1b6f6

View File

@ -115,6 +115,8 @@ module ActiveModel
# end # end
# #
class Serializer class Serializer
INCLUDE_METHODS = {}
class IncludeError < StandardError class IncludeError < StandardError
attr_reader :source, :association attr_reader :source, :association
@ -351,6 +353,9 @@ module ActiveModel
def define_include_method(name) def define_include_method(name)
method = "include_#{name}?".to_sym method = "include_#{name}?".to_sym
INCLUDE_METHODS[name] = method
unless method_defined?(method) unless method_defined?(method)
define_method method do define_method method do
true true
@ -504,7 +509,7 @@ module ActiveModel
end end
def include?(name) def include?(name)
send "include_#{name}?".to_sym send INCLUDE_METHODS[name]
end end
def include!(name, options={}) def include!(name, options={})