采集 类型检查集 例 type = String collection = Collection :: Set . new ( type ) collection . add ( 'something' ) collection . entry? { | v | v == 'something' } # => true collection . entry? ( 'something' ) # => true collection . add ( :not_a_string ) # => ArgumentError (:not_a_string must be a String) 通用风格 t