class Fried::Typings::StrictlyOneOf

Checks if the object.class is exactly one of the passed types

Attributes

types[R]

Public Class Methods

new(*types) click to toggle source
# File lib/fried/typings/strictly_one_of.rb, line 18
def initialize(*types)
  @types = types
end

Public Instance Methods

valid?(obj) click to toggle source
# File lib/fried/typings/strictly_one_of.rb, line 22
def valid?(obj)
  types.any? do |type|
    IsStrictly[type].valid?(obj)
  end
end