Sha256: 4813c154b55013e8d5c7dfb467f0190973bc7bd5c412fa55a207a90414579205
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 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) @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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shiyo-0.1.2 | lib/shiyo/or.rb |
shiyo-0.1.1 | lib/shiyo/or.rb |