immutable-struct 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immutable-struct.rb +4 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79b8217337e96a8a7514ea7cfef14f75176fe8468dd552d0c523f934483d5080
4
- data.tar.gz: b7517bc4e1ae43423a4483d2fa42a4913710453fc00a17cab37bc78ee6b83d33
3
+ metadata.gz: e0ef4c872306eeb408eaaee1d514de56f0917cbb5ab32a721279feb6e4ed1971
4
+ data.tar.gz: 5c1afb5b32cb4edf20ec71ad760927ac376c582826eb4a96d276860cf4710efa
5
5
  SHA512:
6
- metadata.gz: dba93bcdabd6fdcaaa137ad6c3b20ab379ecc64128aa19f5ae796e13ef9d04d0a66c9fa2becef11bbee15488793b7ebad3c8c42047f541b1226284ff02f78c44
7
- data.tar.gz: 1478ce402dea03830755e8b28393683c7da8a308247c7db39d0856c0eb95e4e56276fc3926ab3b469bf9a4a4f07b9435951535b3e91498e6a0f1960714e5c801
6
+ metadata.gz: f4c5c9f24d9650b8c42bd57d9266973540ffce2990aae6b7407e95a3fd2dc9e533d943fe4eaf357c40dc9bb2c1598bd59d054571a0a42de0a70bc9b791e0ac03
7
+ data.tar.gz: 8512b6b471c543b5379224ca029c529ee0550f889d27b0986e3bc26e6ea45ec03932cc1d41bc2178e288d53baafdcc1e1e8f7a732e5cd6c035c59863c408b0ea
@@ -6,7 +6,7 @@
6
6
  # will be evaluated as if it were inside a class definition, allowing you
7
7
  # to add methods, include or extend modules, or do whatever else you want.
8
8
  class ImmutableStruct
9
- VERSION='2.4.0' #:nodoc:
9
+ VERSION='2.4.1' #:nodoc:
10
10
  # Create a new class with the given read-only attributes.
11
11
  #
12
12
  # attributes:: list of symbols or strings that can be used to create attributes.
@@ -72,7 +72,7 @@ class ImmutableStruct
72
72
  end
73
73
  end
74
74
 
75
- define_singleton_method(:from) do |value|
75
+ def self.from(value)
76
76
  case value
77
77
  when self then value
78
78
  when Hash then new(value)
@@ -105,9 +105,9 @@ class ImmutableStruct
105
105
  end
106
106
  end
107
107
 
108
- define_method(:merge) do |new_attrs|
108
+ def merge(new_attrs)
109
109
  attrs = to_h
110
- klass.new(attrs.merge(new_attrs))
110
+ self.class.new(attrs.merge(new_attrs))
111
111
  end
112
112
 
113
113
  alias_method :eql?, :==
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immutable-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stitch Fix Engineering
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-03-20 00:00:00.000000000 Z
13
+ date: 2019-04-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler