Sha256: a6e17b94aa8f768fb8cdeb612a9d62699709507fdec934b05461a9847cde9e09
Contents?: true
Size: 466 Bytes
Versions: 5
Compression:
Stored size: 466 Bytes
Contents
module Monolens module Type class Responding include Type::ErrorHandling def initialize(messages) @messages = messages end def self.to(*messages) new(messages) end def dress(instance, registry, &block) fail!("Invalid #{instance}", &block) unless self === instance instance end def ===(instance) @messages.all?{|m| instance.respond_to?(m) } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems