Sha256: b5c8d409158ffbfbee5bdd552fd43edd20f0c88f7063d7fba70f4a063d4d5263
Contents?: true
Size: 848 Bytes
Versions: 1
Compression:
Stored size: 848 Bytes
Contents
# frozen_string_literal: true module Shiyo # The class to create a composite specification for checking # whether the candidate satisfies any of the two specifications. class Or include Shiyo::Specification # A new instance of Shiyo::Or # # @param one [Shiyo::Specification] A specification object. # @param other [Shiyo::Specification] The other specification object. def initialize(one, other) super() @one = Shiyo::Specification(one) @other = Shiyo::Specification(other) end # Inspects whether the candidate satisfies any of the wrapped specifications. # # @param candidate [Object] The candidate object to be inspected. # @return [Boolean] The result. def satisfied_by?(candidate) @one.satisfied_by?(candidate) || @other.satisfied_by?(candidate) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shiyo-0.1.0 | lib/shiyo/or.rb |