Sha256: 558a61e58266746c76108ecb75255a0738b6ad454b5765c8b8c67d436e547439
Contents?: true
Size: 955 Bytes
Versions: 1
Compression:
Stored size: 955 Bytes
Contents
# frozen_string_literal: true require 'ice_nine' require 'dry/core/deprecations' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-struct-1.3.0 | lib/dry/struct/value.rb |