module Stronger::Collection
Constants
- Interface
Attributes
type[R]
Public Class Methods
new(type, *rest)
click to toggle source
Calls superclass method
# File lib/stronger/collection.rb, line 7 def initialize(type, *rest) @type = type super(*rest) end
Private Instance Methods
check_collection_type!(col)
click to toggle source
# File lib/stronger/collection.rb, line 20 def check_collection_type!(col) unless col.implements?(Collection::Interface) and col.type < type raise TypeError, "#{self} may only be concatenated with an array of the same type!" end end
check_value_type!(val)
click to toggle source
# File lib/stronger/collection.rb, line 14 def check_value_type!(val) unless val.is_strong?(type) raise TypeError, "#{self} expects values of type: #{type}" end end