Class: Contracts::Constraints::All
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*items) ⇒ All
constructor
A new instance of All.
- #matches?(value) ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(*items) ⇒ All
Returns a new instance of All.
286 |
# File 'lib/contracts.rb', line 286 def initialize(*items) = @items = items.map { |item| Constraints.coerce(item) } |
Instance Method Details
#description ⇒ Object
288 |
# File 'lib/contracts.rb', line 288 def description = @items.map(&:description).join(" and ") |
#matches?(value) ⇒ Boolean
287 |
# File 'lib/contracts.rb', line 287 def matches?(value) = @items.all? { |item| item.matches?(value) } |
#to_h ⇒ Object
289 |
# File 'lib/contracts.rb', line 289 def to_h = super.merge(items: @items.map(&:description)) |