Sha256: d9f00db148885c278f137ece0840e0ffce4085224f0199f68d8aba19fbc0d2b7
Contents?: true
Size: 907 Bytes
Versions: 2
Compression:
Stored size: 907 Bytes
Contents
# frozen_string_literal: true require "ice_nine" module Dry class Struct extend Core::Deprecations[:"dry-struct"] # {Value} objects behave like {Struct}s but *deeply frozen* # using [`ice_nine`](https://github.com/dkubb/ice_nine) # # @example # class Location < Dry::Struct::Value # attribute :lat, Types::Float # attribute :lng, Types::Float # end # # loc1 = Location.new(lat: 1.23, lng: 4.56) # loc2 = Location.new(lat: 1.23, lng: 4.56) # # loc1.frozen? #=> true # loc2.frozen? #=> true # loc1 == loc2 #=> true # # @see https://github.com/dkubb/ice_nine class Value < self abstract # @param (see ClassInterface#new) # @return [Value] # @see https://github.com/dkubb/ice_nine def self.new(*) = ::IceNine.deep_freeze(super) end deprecate_constant :Value end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-struct-1.7.1 | lib/dry/struct/value.rb |
dry-struct-1.7.0 | lib/dry/struct/value.rb |