Class: Contracts::Constraints::ArrayOf
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(item) ⇒ ArrayOf
constructor
A new instance of ArrayOf.
- #matches?(value) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(item) ⇒ ArrayOf
Returns a new instance of ArrayOf.
252 |
# File 'lib/contracts.rb', line 252 def initialize(item) = @item = Constraints.coerce(item) |
Instance Method Details
#description ⇒ Object
254 |
# File 'lib/contracts.rb', line 254 def description = "Array<#{@item.description}>" |
#matches?(value) ⇒ Boolean
253 |
# File 'lib/contracts.rb', line 253 def matches?(value) = value.is_a?(Array) && value.all? { |v| @item.matches?(v) } |