Sha256: 36088f543cf8860f81773cff2b964f4d5ce7112ba962b0d890f58ca2cc9d1c14
Contents?: true
Size: 435 Bytes
Versions: 1
Compression:
Stored size: 435 Bytes
Contents
# frozen_string_literal: true module Slack module BlockKit class TypeRestrictedArray < Array undef_method :concat, :[]= # Surely never necessary lol def initialize(*classes) @classes = classes end def <<(item) unless @classes.any? { |cls| item.is_a?(cls) } raise TypeError, "#{self.class} only accepts #{@classes}" end super(item) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slack-block-kit-0.1.0 | lib/slack/block_kit/type_restricted_array.rb |