lib/httparty.rb
module HTTParty
module AllowedFormatsDeprecation
def const_missing(const)
if const.to_s =~ /AllowedFormats$/
Kernel.warn("Deprecated: Use HTTParty::Parser::SupportedFormats")
HTTParty::Parser::SupportedFormats
else
super
end
end
end
extend AllowedFormatsDeprecation
def self.included(base)
base.extend ClassMethods
base.send :include, HTTParty::ModuleInheritableAttributes
base.send(:mattr_inheritable, :default_options)
base.send(:mattr_inheritable, :default_cookies)
base.instance_variable_set("@default_options", {})
base.instance_variable_set("@default_cookies", CookieHash.new)
end
module ClassMethods
extend AllowedFormatsDeprecation
...
代码extend AllowedFormatsDeprecation
在这两处的意义分别是什么?
特别是第二处,完全感觉不到有什么用处,求大大们解释下