1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Convert Template::Types.type_klass to instance ivar

This commit is contained in:
John Hawthorn 2021-04-15 17:56:39 -07:00
parent 6d624c648c
commit 33e054edbc

View file

@ -4,7 +4,7 @@ require "active_support/core_ext/module/attribute_accessors"
module ActionView
class Template #:nodoc:
class Types
module Types
class Type
SET = Struct.new(:symbols).new([ :html, :text, :js, :css, :xml, :json ])
@ -37,21 +37,23 @@ module ActionView
end
end
cattr_accessor :type_klass
class << self
attr_accessor :type_klass
def self.delegate_to(klass)
self.type_klass = klass
def delegate_to(klass)
self.type_klass = klass
end
def [](type)
type_klass[type]
end
def symbols
type_klass::SET.symbols
end
end
delegate_to Type
def self.[](type)
type_klass[type]
end
def self.symbols
type_klass::SET.symbols
end
end
end
end