module ActiveSupport class TypedArray < Array def self.type_cast(obj) obj end def initialize(*args) super(*args).map! { |obj| self.class.type_cast(obj) } end def <<(obj) super(self.class.type_cast(obj)) end def concat(array) super(array.map! { |obj| self.class.type_cast(obj) }) end def insert(index, obj) super(index, self.class.type_cast(obj)) end def push(*objs) super(*objs.map { |obj| self.class.type_cast(obj) }) end def unshift(*objs) super(*objs.map { |obj| self.class.type_cast(obj) }) end end end