Sha256: 4f8b66baad0899b020504f2db9b077eb6a8ac09d2f4b741cbd3ef3082c31ac53
Contents?: true
Size: 680 Bytes
Versions: 2
Compression:
Stored size: 680 Bytes
Contents
require 'casting/version' require 'casting/client' require 'casting/enum' require 'casting/super_delegate' require 'casting/null' require 'casting/context' module Casting class InvalidClientError < StandardError; end def self.delegating(assignments) assignments.each do |object, mod| cast_object(object, mod) end yield ensure assignments.each do |object, mod| uncast_object(object) end end def self.cast_object(object, mod) raise InvalidClientError.new unless object.respond_to?(:cast_as) object.cast_as(mod) end def self.uncast_object(object) return unless object.respond_to?(:uncast) object.uncast end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
casting-1.0.1 | lib/casting.rb |
casting-1.0.0 | lib/casting.rb |