Replace class attribute with SET constant.
We'll be using this to map over to Action Dispatch's Mime::Set.
This commit is contained in:
parent
c10bb2996a
commit
b1dcfa782e
@ -5,13 +5,12 @@ module ActionView
|
|||||||
class Template
|
class Template
|
||||||
class Types
|
class Types
|
||||||
class Type
|
class Type
|
||||||
cattr_accessor :types
|
SET = Set.new([ :html, :text, :js, :css, :xml, :json ])
|
||||||
self.types = Set.new([ :html, :text, :js, :css, :xml, :json ])
|
|
||||||
|
|
||||||
def self.[](type)
|
def self.[](type)
|
||||||
return type if type.is_a?(self)
|
return type if type.is_a?(self)
|
||||||
|
|
||||||
if type.is_a?(Symbol) || types.member?(type.to_s)
|
if type.is_a?(Symbol) || SET.member?(type.to_s)
|
||||||
new(type)
|
new(type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user