Sha256: a4d1d5c394935bce5cc67a3f0f1c2be8624b6acbbf60159b88565b65fea9955c
Contents?: true
Size: 923 Bytes
Versions: 4
Compression:
Stored size: 923 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 end deprecate_constant :Value end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dry-struct-1.6.0 | lib/dry/struct/value.rb |
dry-struct-1.5.2 | lib/dry/struct/value.rb |
dry-struct-1.5.1 | lib/dry/struct/value.rb |
dry-struct-1.5.0 | lib/dry/struct/value.rb |